summaryrefslogtreecommitdiff
path: root/Source/cmGeneratorTarget.cxx
diff options
context:
space:
mode:
authorRobert Maynard <rmaynard@nvidia.com>2023-04-11 15:49:52 -0400
committerRobert Maynard <rmaynard@nvidia.com>2023-05-04 09:39:06 -0400
commitc42630ee62df80e649211e99c510cab7ac28fc0b (patch)
tree8b450a62d4e4c9559b8fe03b11575bde8d154608 /Source/cmGeneratorTarget.cxx
parent0fb923c46041d67110c8e0907afdf66b3b25f25a (diff)
downloadcmake-c42630ee62df80e649211e99c510cab7ac28fc0b.tar.gz
cmGeneratorExpressionNode: implement `COMPILE_ONLY` genex
This generator expression is the inverse of `LINK_ONLY` and only coveys usage requirements for the purposes of compilation. Its intended use is to avoid needing to export targets that do not have link usage requirements (e.g., header-only libraries) when used by another target. See: #15415
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r--Source/cmGeneratorTarget.cxx4
1 files changed, 3 insertions, 1 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 90cddb56b2..7e5ef0a7cb 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -6791,6 +6791,7 @@ void cmGeneratorTarget::ExpandLinkItems(
// requirements.
if (interfaceFor == LinkInterfaceFor::Usage) {
dagChecker.SetTransitivePropertiesOnly();
+ dagChecker.SetTransitivePropertiesOnlyCMP0131();
}
cmMakefile const* mf = this->LocalGenerator->GetMakefile();
LookupLinkItemScope scope{ this->LocalGenerator };
@@ -8229,6 +8230,7 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
// The $<LINK_ONLY> expression may be used to specify link dependencies
// that are otherwise excluded from usage requirements.
if (implFor == LinkInterfaceFor::Usage) {
+ dagChecker.SetTransitivePropertiesOnly();
switch (this->GetPolicyStatusCMP0131()) {
case cmPolicies::WARN:
case cmPolicies::OLD:
@@ -8236,7 +8238,7 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
case cmPolicies::REQUIRED_IF_USED:
case cmPolicies::REQUIRED_ALWAYS:
case cmPolicies::NEW:
- dagChecker.SetTransitivePropertiesOnly();
+ dagChecker.SetTransitivePropertiesOnlyCMP0131();
break;
}
}