[CMake] Add_definitions() also affects RC_FLAGS ?

Georgios Petasis petasisg at yahoo.gr
Sat Jun 28 10:36:47 EDT 2008


O/H Bob Paddock ??????:
> On Sunday 22 June 2008 03:25:21 pm Bill Hoffman wrote:
>   
>> Don't use add_definitions for compiler flags.  Use CMAKE_CXX_FLAGS or
>> CMAKE_C_FLAGS.
>>     
>
> Can you show an example please?
>
> When I try these:
>
> SET (CMAKE_CXX_FLAGS_DEBUG "-Wall" )
> SET (CMAKE_CXX_FLAGS_RELEASE "-Wall" )
> SET (CMAKE_C_FLAGS_DEBUG "-Wall" )
> SET (CMAKE_C_FLAGS_RELEASE "-Wall" )
>
> I do not find "-Wall" in the resultant Makefile (Actually 'Wall' doesn't
> appear *anyplace* in the build directory???),
> for that mater I don't find the default values in
> the Makefile either.  What am I doing wrong?
>
> This after doing a rm -rf Build;mkdir Build... to remove any potential of a 
> cached file being found.
>
> I'm using this to show the values, which do show what I expect to see:
> MESSAGE("c init = ${CMAKE_C_FLAGS_INIT}")
> MESSAGE("c debug init = ${CMAKE_C_FLAGS_DEBUG_INIT}")
> MESSAGE("c release = ${CMAKE_C_FLAGS_RELEASE}")
> MESSAGE("c debug = ${CMAKE_C_FLAGS_DEBUG}")
> MESSAGE("c++ init = ${CMAKE_CXX_FLAGS_INIT}")
> MESSAGE("c++ debug init = ${CMAKE_CXX_FLAGS_DEBUG_INIT}")
> MESSAGE("c++ release = ${CMAKE_CXX_FLAGS_RELEASE}")
> MESSAGE("c++ debug = ${CMAKE_CXX_FLAGS_DEBUG}")
>
> Also if I try to this:
>
> SET (CMAKE_C_FLAGS_RELEASE "-Wall" ${CMAKE_C_FLAGS_RELEASE} )
>
> I get this:
>
> c release = -Wall;-O3 -DNDEBUG
>
> Note the added ";".  Where did that come from?
>
> This is with under Linux with CMake 2.4 patch 8,
> with GCC as the target compiler.
>   
Try:

SET (CMAKE_C_FLAGS_RELEASE "-Wall ${CMAKE_C_FLAGS_RELEASE}" )

George


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080628/6c0cb5cf/attachment.htm>


More information about the CMake mailing list