[CMake] Differentiate between Linux and FreeBSD

Horacio Sanson hsanson at gmail.com
Tue Apr 22 10:27:49 EDT 2008


On Tue, Apr 22, 2008 at 8:31 PM, dizzy <dizzy at roedu.net> wrote:
>
> 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?
>
>  Usually, it all boils down to checking specific conditions, libraries, paths
>  instead of checking a system and then setting those conditions, libraries,
>  paths to expeced values for that system. I find the former much better (and
>  more portable since it will probably work on systems that you have not
>  specifically addressed too).
>

I am new to CMake and the documentation is rather difficult to
digest....  I have a small program that uses SCTP (Stream Control
Transmission Protocol) and it runs in both Linux and FreeBSD.

The problem is that in linux I have to add the sctp library (i.e.
-lsctp) if not compilation fails and in FreeBSD adding that library
would cause the compiler to complain.

if there is a better way to do this I am eager to learn it.


regards,
Horacio
>  --
>  Mihai RUSU                                      Email: dizzy at roedu.net
>                         "Linux is obsolete" -- AST
>
>
> _______________________________________________
>  CMake mailing list
>  CMake at cmake.org
>  http://www.cmake.org/mailman/listinfo/cmake
>


More information about the CMake mailing list