[CMake] Does CMake set preprocessor variables automatically?

Mike Jackson imikejackson at gmail.com
Tue Jan 29 11:29:10 EST 2008


I would take a look at:

http://predef.sourceforge.net/precomp.html

and use those. If _I_ were to do it I would do the following:

If I were targeting specifically windows (MSVC, MINGW, CygWin)

#if __WIN32

#else

  #endif


OR if I was targeting Visual studio then

#if _MSC_VER

#else

#endif


Hope that helps.
mike

On Jan 29, 2008, at 11:14 AM, Convey Christian J NPRI wrote:

> Does CMake automatically set preprocessor variables that indicate  
> the operating system?
>
> I'd like to write some code similar to this:
>
> #ifdef UNIX
>    ...
> #elif WIN#@
>    ...
> #endif
>
> But if CMake is already setting some of those preprocessor  
> variables for me, it's not clear what variables it's setting.
>
> Thanks,
> Christian
>
> Christian Convey
> Scientist, Naval Undersea Warfare Centers
> Newport, RI
>
>


More information about the CMake mailing list