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

Andreas Pakulat apaku at gmx.de
Sat Sep 15 13:32:25 EDT 2012


Hi,

On Sat, Sep 15, 2012 at 12:46 PM, Loaden <loaden at gmail.com> wrote:
> http://www.cmake.org/Wiki/CMake_Useful_Variables
>
>> UNIX  is TRUE on all UNIX-like OS's, including Apple OS X and CygWin WIN32
>> is TRUE on Windows, including CygWin APPLE  is TRUE on Apple systems. Note
>> this does not imply the system is Mac OS X, only that __APPLE__ is #defined
>> in C/C++ header files. Obtain more specific system information via
>> CMAKE_SYSTEM_VERSION, i.e. IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin"), then
>> it's Mac OS X.

I think that mostly refers to MacOS 9 and older which are also apple
systems. So doing a if(UNIX && APPLE) should put you on the safe side
since MacOS 9 and older are not unix systems.

Andreas


More information about the CMake mailing list