[CMake] Does CMake set preprocessor variables automatically?

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


Please excuse the brainfart.  I assume the true answer is that CMake doesn't set any preprocessor variables on its own.  CMake just sets certain CMake variables, and if you want them reflected as preprocessor variables, you write the CMake calls to achieve that.

- C 

> -----Original Message-----
> From: cmake-bounces+conveycj=npt.nuwc.navy.mil at cmake.org 
> [mailto:cmake-bounces+conveycj=npt.nuwc.navy.mil at cmake.org] 
> On Behalf Of Convey Christian J NPRI
> Sent: Tuesday, January 29, 2008 12:03 PM
> To: cmake at cmake.org
> Subject: RE: [CMake] Does CMake set preprocessor variables 
> automatically?
> 
> 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
> > >
> > >
> > 
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
> 


More information about the CMake mailing list