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

Eric Wing ewmailing at gmail.com
Sun Sep 16 18:08:31 EDT 2012


On 9/16/12, Michael Jackson <mike.jackson at bluequartz.net> wrote:
> On Sep 15, 2012, at 1:32 PM, Andreas Pakulat wrote:
>
>> 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
>
> Does CMake even run on OS 9? I don't think so. IMO, I think what the CMake
> devs mean is that one can cross-compile OS X apps on Linux. In this case the
> __APPLE__ would be defined in the headers but the "host" system would be
> Linux (or something else).
>   And "technically" if the system is Darwin it is NOT OS X. Darwin is the
> Unix underpinnings of OS X and it is Open Source. I could run a Darwin
> system and have it NOT be OS X.


Being able to distinguish between Mac OS X and iOS would be useful.
Both technically fall under APPLE and Darwin.


-Eric
-- 
Beginning iPhone Games Development
http://playcontrol.net/iphonegamebook/


More information about the CMake mailing list