[cmake-developers] Extend CMAKE_<LANG>_FLAGS(_<CONFIG>) from a CMake Toolchain

maikel van den Hurk maikelvandenhurk at hotmail.com
Wed Aug 23 11:27:44 EDT 2017

Thanks I was exactly looking for this in particularly, must have searched wrongly!

Though I wonder for example how could I for example change in my toolchain file which is setting up a GCC based compiler for example in release context the optimisation from O3 (CMake internal setting) to O2. It seems that there is mainly done appending instead of prepending to the FLAGS_INIT. Where generally speaking in context of GCC the last defined flag will be used, so how to deal properly with that?

Van: Brad King <brad.king at kitware.com>
Verzonden: woensdag 23 augustus 2017 16:18
Aan: maikel van den Hurk; cmake-developers at cmake.org
Onderwerp: Re: [cmake-developers] Extend CMAKE_<LANG>_FLAGS(_<CONFIG>) from a CMake Toolchain

On 08/23/2017 09:56 AM, maikel van den Hurk wrote:
> I was wondering why there is no ability to define CMAKE_<LANG>_FLAGS(_<CONFIG>) within a CMake Toolchain file, but still benefit from the CMAKE_<LANG>_INIT_FLAGS(_<CONFIG>) detected from CMake internals.

This has been possible since commit v3.7.0-rc1~392^2 (Honor
CMAKE_<LANG>_FLAGS[_<CONFIG>]_INIT set in toolchain files,
2016-07-05).  See the CMake 3.7 release notes:

CMake 3.7 Release Notes — CMake 3.9.1 Documentation<https://cmake.org/cmake/help/v3.9/release/3.7.html#variables>
Generators ¶ The Ninja generator learned to conditionally support Fortran when using a ninja tool that has the necessary features. See generator documentation for ...

  "Toolchain files may now set a CMAKE_<LANG>_FLAGS_INIT variable
  to initialize the CMAKE_<LANG>_FLAGS cache entry the first time
  a language is enabled in a build tree."

See documentation here:

CMAKE_<LANG>_FLAGS_INIT — CMake 3.9.0 Documentation<https://cmake.org/cmake/help/v3.9/variable/CMAKE_LANG_FLAGS_INIT.html>
CMAKE_<LANG>_FLAGS_INIT¶ Value used to initialize the CMAKE_<LANG>_FLAGS cache entry the first time a build tree is configured for language <LANG>.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20170823/e6efe611/attachment.html>

More information about the cmake-developers mailing list