[CMake] Changes to CMAKE_CXX_FLAGS_RELEASE not reflected in GUI

Chuck Atkins chuck.atkins at kitware.com
Thu Jul 23 08:22:04 EDT 2015


> Is this the intended behavior?


Yes.  The GUI is essentially an editor for the CMake cache.  These
variables are persistent with global scope.  As such, only the cache values
are reflected in the GUI.  When you set the CMAKE_CXX_FLAGS_RELEASE with
this form of the set command, you are changing it's value in the current
scope, but not in the cache, hence no updated value in the GUI.



> Is there a way to specify additional
> release build flags in CMakeLists.txt and have them reflected in the
> GUI?
>

You can update the cache entry with the alternate signature for set:

set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -xHost" CACHE
STRING "Flags used by the compiler during release builds." FORCE)

The "FORCE" option is necessary to change an existing cache entry.  See
details for setting cache values here:
http://www.cmake.org/cmake/help/v3.3/command/set.html


Thank you for your recommendations!
>

You're welcome :-)

- Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150723/6ba36713/attachment.html>


More information about the CMake mailing list