[CMake] Differentiate between Linux and FreeBSD

Alexander Neundorf a.neundorf-work at gmx.net
Tue Apr 22 15:10:57 EDT 2008


On Tuesday 22 April 2008, Josef Karthauser wrote:
> > -----Original Message-----
> > From: cmake-bounces at cmake.org [mailto:cmake-bounces at cmake.org] On
> > Behalf Of dizzy
> > Sent: 22 April 2008 12:31
> > To: cmake at cmake.org
> > Subject: Re: [CMake] Differentiate between Linux and FreeBSD
> >
> > On Monday 21 April 2008 12:51:46 Horacio Sanson wrote:
> > > I can use IF(WIN32) and IF(UNIX) to set some variables depending if
> > > cmake is executed in Windows or UNIX systems. The problem is that
> >
> > UNIX
> >
> > > in this context includes both Linux and FreeBSD.
> > >
> > > Has CMake a way to know if it is running in a Linux box or a FreeBSD
> >
> > box??
> >
> > Why do you need to know if it is a Linux or a FreeBSD?
>
> The generic way to tell is to call the 'uname' command, which
> generically tells you what operating system you are running on.  You can

Yes, and this is what cmake itself does to get CMAKE_SYSTEM_NAME (see 
Modules/CMakeDetermineSystem.cmake )

Alex


More information about the CMake mailing list