cmLocalGenerator: Clarify MODULE link flags placeholder population

Clarify comments from commit 8bcf9c7a3e (Add support of "LINKER:" prefix
for artifact creation flags, 2024-10-12, v4.0.0-rc1~522^2~1) about
MODULE library creation flags.  Also avoid falling back to EXECUTABLE
flag placeholders for SHARED or MODULE libraries.  I don't think we
ever populate `CMAKE_<LANG>_CREATE_SHARED_{LIBRARY,MODULE}` from the
value of `CMAKE_<LANG>_LINK_EXECUTALBE`.
This commit is contained in:
Brad King
2025-06-09 15:35:57 -04:00
parent c52a654aa1
commit 6b618c6079

View File

@@ -238,18 +238,17 @@ cmLocalGenerator::CreateRulePlaceholderExpander(
};
switch (targetType) {
// FALLTHROUGH is used because, depending of the compiler and/or
// platform, the wrong variable is used. For example
// CMAKE_SHARED_LIBRARY_CREATE_<LANG>_FLAGS is used to generate a module,
// and the variable CMAKE_SHARED_MODULE_CREATE_<LANG>_FLAGS is ignored.
case cmStateEnums::MODULE_LIBRARY:
updateMapping(
cmStrCat("CMAKE_SHARED_MODULE_CREATE_", language, "_FLAGS"));
// For some toolchains we set CMAKE_${lang}_CREATE_SHARED_MODULE
// to be the same as CMAKE_${lang}_CREATE_SHARED_LIBRARY. Fall
// through to populate the latter's placeholder.
CM_FALLTHROUGH;
case cmStateEnums::SHARED_LIBRARY:
updateMapping(
cmStrCat("CMAKE_SHARED_LIBRARY_CREATE_", language, "_FLAGS"));
CM_FALLTHROUGH;
break;
case cmStateEnums::EXECUTABLE:
updateMapping(cmStrCat("CMAKE_", language, "_LINK_FLAGS"));
break;