Just idly though, I've never yet encountered a situation where:

if(APPLE)
  ...
elseif(UNIX)
  ...
endif()

Wasn't sufficient. The only time I've come close is having to build
automake projects with different flags depending on the os base, and
then (since it only worked under cygwin or msys anyway) if(WIN32) ...
elseif(APPLE) ... else ... endif worked fine.

~
Doug.

On Tue, Sep 18, 2012 at 9:52 PM, Doug <[email protected]> wrote:
> As far as I'm aware the only real way to detect OSX itself is by something 
> like:
>
> #if __APPLE__
>   #include "TargetConditionals.h"
>   #if TARGET_OS_IPHONE
>     ...
>   #elif TARGET_IPHONE_SIMULATOR
>     ...
>   #elif TARGET_OS_MAC
>     ...
>   #endif
> #endif
>
> __APPLE__ is the only constant attached to compiler itself.
>
> ~
> Doug.
>
> On Mon, Sep 17, 2012 at 6:08 AM, Eric Wing <[email protected]> wrote:
>> On 9/16/12, Michael Jackson <[email protected]> wrote:
>>> On Sep 15, 2012, at 1:32 PM, Andreas Pakulat wrote:
>>>
>>>> Hi,
>>>>
>>>> On Sat, Sep 15, 2012 at 12:46 PM, Loaden <[email protected]> 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/
>> --
>>
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at 
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the CMake FAQ at: 
>> http://www.cmake.org/Wiki/CMake_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.cmake.org/mailman/listinfo/cmake
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to