[CMake] Changing PreprocessorDefinitions

Bill Hoffman bill.hoffman at kitware.com
Thu Apr 10 11:30:16 EDT 2008


Michael Andronov wrote:
> Hi,
> Let me explain my question briefly:
> 
> 1. I'm trying to write the CMakeLists.txt, which will generate a proper 
> project for Visual Studio .net.
> 2. Within my CMakeLists.txt, I set the variable:
>    SET (COMPILE_FLAGS "/W3 /nologo /c /Wp64 /ZI /Gd /TP ")
> 3. My expectation is that above variable will be 'translated' into 
> compiler flags within Visual Studio;
> 4. However, the actual flags ( PreprocessorDefinitions) contains some 
> additional options like:
>     POSIX,IA32,DEBUG

These are not defaults from CMake, you must have add_definitions(-DPOSIX 
-DIA32) in your project somewhere.

COMPILE_FLAGS is also not a standard cmake variable for setting flags. 
Perhaps you could try a smaller example or post and example that shows 
the problem.  For example, what do you get with something really simple:

project(foo)
add_library(foo foo.c)



-Bill


More information about the CMake mailing list