[CMake] Re: bug ADD_DEFINITIONS

Peter Kümmel syntheticpp at gmx.net
Fri Jun 9 04:14:20 EDT 2006


Jan Woetzel wrote:
> Peter Kümmel wrote:
> 
>>>>> SET_SOURCE_FILES_PROPERTIES( ${FN2}  PROPERTIES COMPILE_FLAGS
>>>>>       
>>> By the way,
>>> ADD_DEFINTIONS has another bug in Visual Studio 7.1 generator,
>>> see my bug report 3354
>>>
>>> Example:
>>> ADD_DEFINTIONS( -foo )
>>> adds
>>> /D "-foo"
>>> instead of
>>> -foo
>>>
>>> Still talking about cmake 2.4.2 on Windows with MSVS .net 2003
>>> generator.
>>>   
>> As I understand it ADD_DEFINTIONS is only for macro definitions and
>> not for flags in general.
>>  
>>
> (1) The 2.4.2 docu states:
> "Adds flags to command line of C and C++ compilers. This command can be
> used to add any flag to a compile line, but the -D flag is accepted most
> C/C++ compilers. Other flags may not be as portable."
> 

But it starts with: Adds -D define flags to the command line of C and C++ compilers.

> (2) It works as expecetd with gnu makefils generators (Linux gnu make
> and windows nmake), only MSVS 2003 generator adds the extra /D and
> quotes in front.

Yes, seems it is a bug.

>> SET(CMAKE_CXX_FLAGS_DEBUG "-wd4996 -wd4800")
>>  
>>
> I think that does not work with different flags for each subdirectory -
> but I will try.

Yes, the subdirectory handling is sometimes a bit complicated.

Peter


More information about the CMake mailing list