[CMake] Differentiate between Linux and FreeBSD

Pau Garcia i Quiles pgquiles at elpauer.org
Tue Apr 22 04:49:53 EDT 2008


Quoting Horacio Sanson <hsanson at gmail.com>:

> On Mon, Apr 21, 2008 at 7:01 PM, Pau Garcia i Quiles
> <pgquiles at elpauer.org> wrote:
>>
>> Quoting Horacio Sanson <hsanson at gmail.com>:
>>
>>
>> > 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??
>> >
>>
>>  Use the CMAKE_SYSTEM_NAME variable:
>
> I tried using this variable but for some reason it seems to be empty
> (i.e. calling MESSAGE with this var as parameter does not print
> anything). This happens in both Linux (Kubuntu 7.10) and FreeBSD 7.1.
>

It works for me:

MESSAGE( STATUS "Platform: " ${CMAKE_SYSTEM_NAME} )

outputs

-- Platform: Linux

What version of CMake are you using?

-- 
Pau Garcia i Quiles
http://www.elpauer.org
(Due to my workload, I may need 10 days to answer)



More information about the CMake mailing list