cmGeneratorTarget: Pass genex evaluation context to IsTransitiveProperty

This commit is contained in:
Brad King
2025-09-22 09:46:57 -04:00
parent 6201ff1864
commit 9b862e7013
4 changed files with 7 additions and 11 deletions
+1 -3
View File
@@ -35,9 +35,7 @@ cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker(
this->TopIsTransitiveProperty = parent->TopIsTransitiveProperty; this->TopIsTransitiveProperty = parent->TopIsTransitiveProperty;
} else { } else {
this->TopIsTransitiveProperty = this->TopIsTransitiveProperty =
this->Target this->Target->IsTransitiveProperty(this->Property, context, this)
->IsTransitiveProperty(this->Property, context.LG, context.Config,
this)
.has_value(); .has_value();
} }
+1 -2
View File
@@ -2887,8 +2887,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
cmGeneratorTarget::UseTo usage = cmGeneratorTarget::UseTo::Compile; cmGeneratorTarget::UseTo usage = cmGeneratorTarget::UseTo::Compile;
if (cm::optional<cmGeneratorTarget::TransitiveProperty> transitiveProp = if (cm::optional<cmGeneratorTarget::TransitiveProperty> transitiveProp =
target->IsTransitiveProperty(propertyName, eval->Context.LG, target->IsTransitiveProperty(propertyName, eval->Context,
eval->Context.Config,
dagCheckerParent)) { dagCheckerParent)) {
interfacePropertyName = std::string(transitiveProp->InterfaceName); interfacePropertyName = std::string(transitiveProp->InterfaceName);
isInterfaceProperty = transitiveProp->InterfaceName == propertyName; isInterfaceProperty = transitiveProp->InterfaceName == propertyName;
+1 -2
View File
@@ -1012,8 +1012,7 @@ public:
BuiltinTransitiveProperties; BuiltinTransitiveProperties;
cm::optional<TransitiveProperty> IsTransitiveProperty( cm::optional<TransitiveProperty> IsTransitiveProperty(
cm::string_view prop, cmLocalGenerator const* lg, cm::string_view prop, cm::GenEx::Context const& context,
std::string const& config,
cmGeneratorExpressionDAGChecker const* dagChecker) const; cmGeneratorExpressionDAGChecker const* dagChecker) const;
bool HaveInstallTreeRPATH(std::string const& config) const; bool HaveInstallTreeRPATH(std::string const& config) const;
@@ -177,7 +177,7 @@ std::string cmGeneratorTarget::EvaluateInterfaceProperty(
cm::optional<cmGeneratorTarget::TransitiveProperty> cm::optional<cmGeneratorTarget::TransitiveProperty>
cmGeneratorTarget::IsTransitiveProperty( 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 cmGeneratorExpressionDAGChecker const* dagChecker) const
{ {
cm::optional<TransitiveProperty> result; cm::optional<TransitiveProperty> result;
@@ -192,7 +192,7 @@ cmGeneratorTarget::IsTransitiveProperty(
if (i != BuiltinTransitiveProperties.end() && if (i != BuiltinTransitiveProperties.end() &&
// Look up CMP0189 in the context where evaluation occurs, // Look up CMP0189 in the context where evaluation occurs,
// not where the target was created. // not where the target was created.
lg->GetPolicyStatus(cmPolicies::CMP0189) != cmPolicies::NEW && context.LG->GetPolicyStatus(cmPolicies::CMP0189) != cmPolicies::NEW &&
prop == "LINK_LIBRARIES"_s) { prop == "LINK_LIBRARIES"_s) {
i = BuiltinTransitiveProperties.end(); i = BuiltinTransitiveProperties.end();
} }
@@ -200,7 +200,7 @@ cmGeneratorTarget::IsTransitiveProperty(
result = i->second; result = i->second;
if (result->Usage != cmGeneratorTarget::UseTo::Compile) { if (result->Usage != cmGeneratorTarget::UseTo::Compile) {
cmPolicies::PolicyStatus cmp0166 = cmPolicies::PolicyStatus cmp0166 =
lg->GetPolicyStatus(cmPolicies::CMP0166); context.LG->GetPolicyStatus(cmPolicies::CMP0166);
if ((cmp0166 == cmPolicies::WARN || cmp0166 == cmPolicies::OLD) && if ((cmp0166 == cmPolicies::WARN || cmp0166 == cmPolicies::OLD) &&
(prop == "LINK_DIRECTORIES"_s || prop == "LINK_DEPENDS"_s || (prop == "LINK_DIRECTORIES"_s || prop == "LINK_DEPENDS"_s ||
prop == "LINK_OPTIONS"_s)) { prop == "LINK_OPTIONS"_s)) {
@@ -211,7 +211,7 @@ cmGeneratorTarget::IsTransitiveProperty(
// Honor TRANSITIVE_COMPILE_PROPERTIES and TRANSITIVE_LINK_PROPERTIES // Honor TRANSITIVE_COMPILE_PROPERTIES and TRANSITIVE_LINK_PROPERTIES
// from the link closure when we are not evaluating the closure itself. // from the link closure when we are not evaluating the closure itself.
CustomTransitiveProperties const& ctp = CustomTransitiveProperties const& ctp =
this->GetCustomTransitiveProperties(config, propertyFor); this->GetCustomTransitiveProperties(context.Config, propertyFor);
auto ci = ctp.find(std::string(prop)); auto ci = ctp.find(std::string(prop));
if (ci != ctp.end()) { if (ci != ctp.end()) {
result = ci->second; result = ci->second;