diff options
author | Brad King <brad.king@kitware.com> | 2022-11-15 15:53:49 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-11-17 12:57:21 (GMT) |
commit | 8437141b53919619f6d21f5f446d26df42373c68 (patch) | |
tree | 025fe7b9aea2bbdd4504304463ea7299bd4b4d9f /Source/cmGeneratorExpressionNode.cxx | |
parent | d22a225251ebc10323e934a8790984dcbbb9b18a (diff) | |
download | CMake-8437141b53919619f6d21f5f446d26df42373c68.zip CMake-8437141b53919619f6d21f5f446d26df42373c68.tar.gz CMake-8437141b53919619f6d21f5f446d26df42373c68.tar.bz2 |
Genex: Fix TARGET_PROPERTY lookup scope in transitive usage requirements
When `$<TARGET_PROPERTY:tgt,prop>` is used in an `INTERFACE_*` target
property for usage requirements, it may be evaluated in the context of a
dependent target in another directory. Look up the `tgt` name in the
directory of the target whose property holds the expression so that
imported targets isolated to that directory are visible.
Fixes: #24163
Diffstat (limited to 'Source/cmGeneratorExpressionNode.cxx')
-rw-r--r-- | Source/cmGeneratorExpressionNode.cxx | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 562c31e..81629c6 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -1970,7 +1970,10 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode } return std::string(); } - target = context->LG->FindGeneratorTargetToUse(targetName); + cmLocalGenerator const* lg = context->CurrentTarget + ? context->CurrentTarget->GetLocalGenerator() + : context->LG; + target = lg->FindGeneratorTargetToUse(targetName); if (!target) { std::ostringstream e; |