[CMake] FreeBSD compile thinks its __APPLE_ in #ifdefs

Bill Hoffman hoffman.mlist at gmail.com
Thu Mar 22 14:46:28 EST 2007


Philip Lowman wrote:
> Tim Sutton wrote:
>> The code in question looks like this:
>>
>> 4 #ifdef __APPLE__
>> 5 #include <malloc.h>
>> 6 #endif
>>
>> So cmake has decided its an APPLE machine and is incorrectly entering
>> this ifdef. Can any one point me to some notes on making things behave
>> correctly on FreeBSD?
>
> I'd double check and make sure that __APPLE__ isn't getting 
> accidentally  defined somehow by something you're #including.
>
>
> Alternatively, make a small Hello World project for CMake and verify 
> that it's actually defining __APPLE__ when you generate on FreeBSD.
>
> CMakeLists.txt:
> ADD_EXECUTABLE(hello hello.cc)
>
> hello.cc:
>
> #include <iostream>
> int main()
> #ifdef __APPLE__
>    std::cout << "Apple is defined!" << std::endl;
> #endif
>    return 0;
> }
>

make VERBOSE=1

Do you see a -D__APPLE__ on the compiler line?   If so, do this grep -R 
__APPLE__ * in the build tree, and find out which files have it.   I did 
that grep in the cmake tree and found nothing.  What are CFLAGS and 
CXXFLAGS environment variables set to?

-Bill



More information about the CMake mailing list