[CMake] add_definition??

Michael Wild themiwi at gmail.com
Thu Apr 14 00:56:57 EDT 2011


On 04/13/2011 11:50 PM, klaas.holwerda wrote:
> Hi,
> 
> I use ADD_DEFINITIONS( ${wxWidgets_DEFINITIONS} ) to add flags for
> compilation like this:
> 
>     set( wxWidgets_CXX_FLAGS ${wxWidgets_CXX_FLAGS}
>         -D__WXMSW__ -D__GNUWIN32__ -D__WIN95__
>         -fexceptions -fno-pcc-struct-return
>         -fstrict-aliasing
>         -Wall    #all warnings
>         -Wno-unused-variable
>          )
> 
> Now a user complains that those flags are added to CXX_FLAGS as well as
> RC_FLAGS .
> The first is right, the second is a problem for the resource compiler
> windres.exe used in codeblocks IDE.
> 
> What is the right way to set compiler flags for cpp sources and other
> flags for the resource compiler?
> 
> Or are the generated makefiles not correct??
> 
> Thanks,
> 
> Klaas

If you think about the name of the function, adding anything but
preprocessor definitions is just plain wrong. Append them to the
CMAKE_CXX_FLAGS variable instead.

Michael



More information about the CMake mailing list