[CMake] Changes to CMAKE_CXX_FLAGS_RELEASE not reflected in GUI
David Cole
DLRdave at aol.com
Thu Jul 23 09:05:21 EDT 2015
However, be aware of two things if you do use FORCE:
If CMAKE_CXX_FLAGS_RELEASE already contains "-xHost" you will be
appending it *again* each time CMake is run in a given build tree...
So you may want some "if(NOT CMAKE_CXX_FLAGS_RELEASE MATCHES
"-xHost")" logic in there as well.
Also, using FORCE unconditionally essentially eliminates the
possibility of having an end user modify that cache value in the
cmake-gui, since you'll be overwriting it with your value. Consider
making it INTERNAL rather than having it appear in the GUI if you
really need to control its value from CMakeLists rather than allowing
end users to edit it.
HTH,
David C.
On Thu, Jul 23, 2015 at 8:22 AM, Chuck Atkins <chuck.atkins at kitware.com> wrote:
>> 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
>
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake
More information about the CMake
mailing list