diff options
author | Brad King <brad.king@kitware.com> | 2022-03-22 15:09:23 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-03-24 12:23:55 (GMT) |
commit | cf312a2e5423c49cc5da446f5407a6f4a596a3cb (patch) | |
tree | 3bde9691ad13e40b06744b63a2c53dda75cbdf2a /Source/cmGeneratorTarget.cxx | |
parent | 41a6b4a53ba844ef986b0bc4efe8938b97eea810 (diff) | |
download | CMake-cf312a2e5423c49cc5da446f5407a6f4a596a3cb.zip CMake-cf312a2e5423c49cc5da446f5407a6f4a596a3cb.tar.gz CMake-cf312a2e5423c49cc5da446f5407a6f4a596a3cb.tar.bz2 |
LINK_LIBRARIES: Add support for LINK_ONLY genex
Previously we always used content guarded by `$<LINK_ONLY:...>`
in `LINK_LIBRARIES`, even when evaluating for non-linking usage
requirements. Add a policy to honor `LINK_ONLY` in `LINK_LIBRARIES`
the same way we already do in `INTERFACE_LINK_LIBRARIES`.
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 6c804b5..1a13bdb 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -8152,6 +8152,20 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries( // Keep this logic in sync with ExpandLinkItems. cmGeneratorExpressionDAGChecker dagChecker(this, "LINK_LIBRARIES", nullptr, nullptr); + // The $<LINK_ONLY> expression may be used to specify link dependencies + // that are otherwise excluded from usage requirements. + if (implFor == LinkInterfaceFor::Usage) { + switch (this->GetPolicyStatusCMP0131()) { + case cmPolicies::WARN: + case cmPolicies::OLD: + break; + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::NEW: + dagChecker.SetTransitivePropertiesOnly(); + break; + } + } cmGeneratorExpression ge(entry.Backtrace); std::unique_ptr<cmCompiledGeneratorExpression> const cge = ge.Parse(entry.Value); |