[CMake] Does CMake set preprocessor variables automatically?

Convey Christian J NPRI ConveyCJ at Npt.NUWC.Navy.Mil
Tue Jan 29 12:02:35 EST 2008


Awesome!  Thanks.

I wonder why it's not in CMake's online docs. 

> -----Original Message-----
> From: Mike Jackson [mailto:imikejackson at gmail.com] 
> Sent: Tuesday, January 29, 2008 11:29 AM
> To: Convey Christian J NPRI
> Cc: cmake at cmake.org
> Subject: Re: [CMake] Does CMake set preprocessor variables 
> automatically?
> 
> 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