[CMake] FreeBSD compile thinks its __APPLE_ in #ifdefs

Philip Lowman philip at yhbt.com
Thu Mar 22 13:09:20 EST 2007


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;
}

-- 
Philip Lowman
Simulation Development Engineer, Modeling and Simulation Technology
General Dynamics Land Systems
http://www.gdls.com


More information about the CMake mailing list