[CMake] #1f/#endif trouble...

Mike Jackson mike.jackson at bluequartz.net
Sun Aug 16 17:57:59 EDT 2009


Yes, __APPLE__ is the preferred marker to decide if you are compiling
on OS X. It is used in exactly the type of code that you presented.
CMake, VTK, ITK, ParaView all use this construct. As far as I know
Apple's GCC predefines it so you will not see it on the command line.
I know it works because I use it on Tiff, Expat, HDF5 and all my own
projects with makefiles and Xcode projects and I have not had any
difficultly using it.
_________________________________________________________
Mike Jackson                  mike.jackson at bluequartz.net

On Sun, Aug 16, 2009 at 5:41 PM, ML<mailinglists at mailnewsrss.com> wrote:
> Does #if(__APPLE__) replace #if TARGET_OS_MAC now then?
>
> Is there a list of these that make uses?
>
> On Aug 16, 2009, at 2:38 PM, Mike Jackson wrote:
>
>> #if defined (__APPLE__) is there when compiling under a complete OS X
>> installation.
>> _________________________________________________________
>> Mike Jackson                  mike.jackson at bluequartz.net
>> BlueQuartz Software                    www.bluequartz.net
>> Principal Software Engineer                  Dayton, Ohio
>>
>>
>>
>>
>> On Sun, Aug 16, 2009 at 5:27 PM, ML<mailinglists at mailnewsrss.com> wrote:
>>>
>>> Hi All,
>>>
>>> I am continuing my quest moving from XCode to CMake/Make
>>>
>>> This may be a Make specific question though.
>>>
>>> It would seem to me that
>>>
>>> #if TARGET_OS_MAC
>>>
>>> #endif
>>>
>>> is not getting executed in my code.
>>>
>>> I have:
>>>
>>> #if TARGET_OS_MAC
>>>       typedef unsigned char
>>>  UInt8;
>>>       typedef signed char
>>>  SInt8;
>>>       typedef unsigned short
>>>  UInt16;
>>>       typedef signed short
>>>   SInt16;
>>>       typedef unsigned long
>>>  UInt32;
>>>       typedef signed long
>>>  SInt32;
>>> #endif // TARGET_OS_MAC
>>>
>>> and I get undefined errors, but when I comment out the #if and #end if,
>>> the
>>> errors go away. My question is why?
>>>
>>> is there a better #if to use for OS X than TARGET_OS_MAC?
>>>
>>> -Jason
>>> _______________________________________________
>>> 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
>>>
>
>


More information about the CMake mailing list