[Cmake] How to remove a #define?

Mathews, Rob rmathews at envoyww . com
Tue, 23 Sep 2003 16:43:48 -0400


And of course it fails as soon as you use a real-world example. For example,


ADD_DEFINITIONS(-DUNICODE -D_UNICODE -DWIN32 -Di386 -D_WIN32_WINNT=0x501 )
ADD_DEFINITIONS("-UUNICODE")
ADD_EXECUTABLE(test_cmake  test.cpp)

Gives you an interesting error at compile time when the _WIN32_WINNT macro
is expanded and is considered to include "-UUNICODE" as part of its value.

However, the following *hack* does happen work: 

ADD_DEFINITIONS(-DUNICODE -D_UNICODE -DWIN32 -Di386 -D_WIN32_WINNT=0x501 )
ADD_DEFINITIONS(",-UUNICODE")
ADD_EXECUTABLE(test_cmake  test.cpp)

Note the magic "," - it actually seems to cause .NET to consider the
following words as a new command line argument.

Rob.

> -----Original Message-----
> From: Mathews, Rob 
> Sent: Tuesday, September 23, 2003 1:40 PM
> To: 'Brad King'; Mathews, Rob
> Cc: 'Karr, David'; Andy Cedilnik; cmake at www . cmake . org
> Subject: RE: [Cmake] How to remove a #define?
> 
> 
> I tried it. It seems to work, although it would probably be a 
> cleaner .vcproj file if the generator for .NET understood 
> that "-U" natively.
> 
> At least, a trivial example line: 
> 
> ADD_DEFINITIONS("-DFOO")
> ADD_DEFINITIONS("-UFOO")
> ADD_EXECUTABLE(test_cmake  test.cpp)
> 
> does result in FOO being undefined while compiling test.cpp.
> 
> Rob.
> 
> > -----Original Message-----
> > From: Brad King [mailto:brad . king at kitware . com]
> > Sent: Tuesday, September 23, 2003 10:14 AM
> > To: Mathews, Rob
> > Cc: 'Karr, David'; Andy Cedilnik; cmake at www . cmake . org
> > Subject: Re: [Cmake] How to remove a #define?
> > 
> > 
> > 
> > > ADD_DEFINITIONS - Add -D define flags to command line for 
> > environments.
> > > Usage: ADD_DEFINITIONS(-DFOO -DBAR ...) Add -D define flags 
> > to command
> > > line for environments.
> > 
> > You can try this, but I haven't tested it:
> > 
> > ADD_DEFINITIONS(-UFOO -UBAR)
> > 
> > -Brad
> > 
>