From 5ecee0db7b83eed751e4ac8cb2631483d2b2a407 Mon Sep 17 00:00:00 2001 From: Tyler Yankee Date: Tue, 27 Jan 2026 13:57:51 -0500 Subject: [PATCH] cmLocalGenerator: De-duplicate static linker flags lookup Be sure to obey CMP0181 by not applying `LINKER:` expansion etc. to the flags in this variable, unlike shared library, module library, and executable targets. --- Source/cmLocalGenerator.cxx | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 572e6a41d3..6625d8b02b 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1405,24 +1405,18 @@ std::vector> cmLocalGenerator::GetStaticLibraryFlags( std::string const& config, std::string const& linkLanguage, cmGeneratorTarget* target) { - std::string const configUpper = cmSystemTools::UpperCase(config); std::vector> flags; if (linkLanguage != "Swift" && !this->IsSplitSwiftBuild()) { std::string staticLibFlags; - this->AppendFlags( - staticLibFlags, - this->Makefile->GetSafeDefinition("CMAKE_STATIC_LINKER_FLAGS")); - if (!configUpper.empty()) { - std::string name = "CMAKE_STATIC_LINKER_FLAGS_" + configUpper; - this->AppendFlags(staticLibFlags, - this->Makefile->GetSafeDefinition(name)); - } + this->AddConfigVariableFlags(staticLibFlags, "CMAKE_STATIC_LINKER_FLAGS", + config); if (!staticLibFlags.empty()) { flags.emplace_back(std::move(staticLibFlags)); } } std::string staticLibFlags; + std::string const configUpper = cmSystemTools::UpperCase(config); this->AppendFlags(staticLibFlags, target->GetSafeProperty("STATIC_LIBRARY_FLAGS")); if (!configUpper.empty()) {