Skip to content

Modules: Initialize per-language platform-specific flag variables consistently

Brad King requested to merge brad.king/cmake:lang-platform-flags into master

The Platform/<OS>.cmake modules record platform-specific flag variables for the C toolchain. The CMake<LANG>Information modules initialize the per-language platform-specific flag variables to defaults copied from C. However, they have diverged over time, and not all platform-specific flag variables are initialized correctly for all languages. Factor out the CXX language's instance of this logic into a helper macro, and re-use it for all languages for which we previously had the platform-specific flag variables at least partially filled out.

Previously the Fortran language's copy of this logic used if(NOT DEFINED <var>) instead of just if(NOT <var>) to allow Platform/<OS>-<COMPILER_ID>-<LANG> modules to specify empty values for some platform-specific flag variables without being overridden. Use this approach in the helper macro so it applies to all languages.

Fixes: #25990 (closed)

Merge request reports