[CMake] cmake-gui(beta) does not show a change in CMAKE_CXX_FLAGS

Bill Hoffman bill.hoffman at kitware.com
Mon Dec 1 15:39:24 EST 2008


David Genest wrote:
> Hi, 
> 
>  In a Visual Studio Generator context... 
> 
>  I set a compiler flag in my CMakeLists.txt, but the change is not
> reflected in the gui (advanced values), even if the project setting is
> correct. I find this error prone, because it gives the user incorrect
> information about the current configuration. Is this by design?
> 
>  Example code: 
> 
>  Set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHa")
> 
>  I would expect to see this change in the gui also. But now I see /EHsc.
> 
> Thanks, 
> 
That is because you are setting the value in memory and not in the 
cache. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHa" CACHE FORCE "") 
will do what you want.  However, the user will NOT be able to edit from 
the gui if you do that.  Because each time cmake is run the cache FORCE 
will change the values.

-Bill


More information about the CMake mailing list