summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-08-06 14:55:12 (GMT)
committerKitware Robot <kwrobot@kitware.com>2021-08-06 14:55:48 (GMT)
commit86633cc203d58090b11e8d67aa47777575084292 (patch)
treeec35f9cc2b310284acba7c9d755d5076a4f2d308 /Source
parentf21ed57ecb1dcd3a282d73ac56286d4d8b7c7022 (diff)
parent93eb4a7bd17f0da02a5ea71426bed5c2056e9ea0 (diff)
downloadCMake-86633cc203d58090b11e8d67aa47777575084292.zip
CMake-86633cc203d58090b11e8d67aa47777575084292.tar.gz
CMake-86633cc203d58090b11e8d67aa47777575084292.tar.bz2
Merge topic 'ninja-lwyu-ar' into release-3.21
93eb4a7bd1 Ninja: Revert accidental LINK_WHAT_YOU_USE impl for static libraries Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !6418
Diffstat (limited to 'Source')
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx5
1 files changed, 4 insertions, 1 deletions
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 493bd4a..5c21d1b 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -1156,7 +1156,10 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement(
this->AddModuleDefinitionFlag(linkLineComputer.get(), vars["LINK_FLAGS"],
config);
- if (gt->GetPropertyAsBool("LINK_WHAT_YOU_USE")) {
+ if (gt->GetPropertyAsBool("LINK_WHAT_YOU_USE") &&
+ (gt->GetType() == cmStateEnums::TargetType::EXECUTABLE ||
+ gt->GetType() == cmStateEnums::TargetType::SHARED_LIBRARY ||
+ gt->GetType() == cmStateEnums::TargetType::MODULE_LIBRARY)) {
vars["LINK_FLAGS"] += " -Wl,--no-as-needed";
}
vars["LINK_FLAGS"] = globalGen->EncodeLiteral(vars["LINK_FLAGS"]);