[CMake] How to check the operating system is MacOSX?

Loaden loaden at gmail.com
Sat Sep 15 00:05:29 EDT 2012


Follow this wiki:
http://www.itk.org/Wiki/CMake/Examples#Check_operating_system
There say:

>  IF(WIN32)
>    ...do something...
>  ELSE(WIN32)
>    ...do something else...
>  ENDIF(WIN32)
>
>  or:
>
> IF(CMAKE_SYSTEM_NAME STREQUAL Linux)
>
>
As I know:
if (APPLE)
...
endif()
is not enough.

For now I have to using:

if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
>     set(WINDOWS TRUE)
> elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
>     set(LINUX TRUE)
> elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
>     set(MACOSX TRUE)
> endif()
>

My question:
How to check the operating system is MacOSX?

-- 
Best Regards
Yuchen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120915/617924e9/attachment.htm>


More information about the CMake mailing list