From 6b618c6079da913ce5ccfb63281db1b72cca8a7e Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 9 Jun 2025 15:35:57 -0400 Subject: [PATCH] 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__CREATE_SHARED_{LIBRARY,MODULE}` from the value of `CMAKE__LINK_EXECUTALBE`. --- Source/cmLocalGenerator.cxx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 10c6517e22..a628a57a53 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -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__FLAGS is used to generate a module, - // and the variable CMAKE_SHARED_MODULE_CREATE__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;