From 9b862e7013a9fe2149f49cb207142309ee0fa0c0 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 22 Sep 2025 09:46:57 -0400 Subject: [PATCH] cmGeneratorTarget: Pass genex evaluation context to IsTransitiveProperty --- Source/cmGeneratorExpressionDAGChecker.cxx | 4 +--- Source/cmGeneratorExpressionNode.cxx | 3 +-- Source/cmGeneratorTarget.h | 3 +-- Source/cmGeneratorTarget_TransitiveProperty.cxx | 8 ++++---- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx index c7e71f7c78..77946f3115 100644 --- a/Source/cmGeneratorExpressionDAGChecker.cxx +++ b/Source/cmGeneratorExpressionDAGChecker.cxx @@ -35,9 +35,7 @@ cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker( this->TopIsTransitiveProperty = parent->TopIsTransitiveProperty; } else { this->TopIsTransitiveProperty = - this->Target - ->IsTransitiveProperty(this->Property, context.LG, context.Config, - this) + this->Target->IsTransitiveProperty(this->Property, context, this) .has_value(); } diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 183d3cb019..98f8c72639 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -2887,8 +2887,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode cmGeneratorTarget::UseTo usage = cmGeneratorTarget::UseTo::Compile; if (cm::optional transitiveProp = - target->IsTransitiveProperty(propertyName, eval->Context.LG, - eval->Context.Config, + target->IsTransitiveProperty(propertyName, eval->Context, dagCheckerParent)) { interfacePropertyName = std::string(transitiveProp->InterfaceName); isInterfaceProperty = transitiveProp->InterfaceName == propertyName; diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index b31645a7cd..6fd29de487 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -1012,8 +1012,7 @@ public: BuiltinTransitiveProperties; cm::optional IsTransitiveProperty( - cm::string_view prop, cmLocalGenerator const* lg, - std::string const& config, + cm::string_view prop, cm::GenEx::Context const& context, cmGeneratorExpressionDAGChecker const* dagChecker) const; bool HaveInstallTreeRPATH(std::string const& config) const; diff --git a/Source/cmGeneratorTarget_TransitiveProperty.cxx b/Source/cmGeneratorTarget_TransitiveProperty.cxx index a6ab68c2d3..85557f27b8 100644 --- a/Source/cmGeneratorTarget_TransitiveProperty.cxx +++ b/Source/cmGeneratorTarget_TransitiveProperty.cxx @@ -177,7 +177,7 @@ std::string cmGeneratorTarget::EvaluateInterfaceProperty( cm::optional cmGeneratorTarget::IsTransitiveProperty( - cm::string_view prop, cmLocalGenerator const* lg, std::string const& config, + cm::string_view prop, cm::GenEx::Context const& context, cmGeneratorExpressionDAGChecker const* dagChecker) const { cm::optional result; @@ -192,7 +192,7 @@ cmGeneratorTarget::IsTransitiveProperty( if (i != BuiltinTransitiveProperties.end() && // Look up CMP0189 in the context where evaluation occurs, // not where the target was created. - lg->GetPolicyStatus(cmPolicies::CMP0189) != cmPolicies::NEW && + context.LG->GetPolicyStatus(cmPolicies::CMP0189) != cmPolicies::NEW && prop == "LINK_LIBRARIES"_s) { i = BuiltinTransitiveProperties.end(); } @@ -200,7 +200,7 @@ cmGeneratorTarget::IsTransitiveProperty( result = i->second; if (result->Usage != cmGeneratorTarget::UseTo::Compile) { cmPolicies::PolicyStatus cmp0166 = - lg->GetPolicyStatus(cmPolicies::CMP0166); + context.LG->GetPolicyStatus(cmPolicies::CMP0166); if ((cmp0166 == cmPolicies::WARN || cmp0166 == cmPolicies::OLD) && (prop == "LINK_DIRECTORIES"_s || prop == "LINK_DEPENDS"_s || prop == "LINK_OPTIONS"_s)) { @@ -211,7 +211,7 @@ cmGeneratorTarget::IsTransitiveProperty( // Honor TRANSITIVE_COMPILE_PROPERTIES and TRANSITIVE_LINK_PROPERTIES // from the link closure when we are not evaluating the closure itself. CustomTransitiveProperties const& ctp = - this->GetCustomTransitiveProperties(config, propertyFor); + this->GetCustomTransitiveProperties(context.Config, propertyFor); auto ci = ctp.find(std::string(prop)); if (ci != ctp.end()) { result = ci->second;