From 91a25de5206b53a4a1fd61d8d2bf13a76fce7ad0 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 11 Apr 2024 13:49:12 -0400 Subject: cmGeneratorExpression: Add comments on implementation details Clarify the purpose of some genex code that collects properties over the transitive link closure. --- Source/cmGeneratorExpressionDAGChecker.cxx | 3 +++ Source/cmGeneratorExpressionNode.cxx | 4 ++++ Source/cmGeneratorTarget.cxx | 1 + 3 files changed, 8 insertions(+) diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx index da5785e..5343c98 100644 --- a/Source/cmGeneratorExpressionDAGChecker.cxx +++ b/Source/cmGeneratorExpressionDAGChecker.cxx @@ -141,12 +141,15 @@ bool cmGeneratorExpressionDAGChecker::GetTransitivePropertiesOnlyCMP0131() bool cmGeneratorExpressionDAGChecker::EvaluatingGenexExpression() const { + // Corresponds to GenexEvaluator::EvaluateExpression. return cmHasLiteralPrefix(this->Property, "TARGET_GENEX_EVAL:") || cmHasLiteralPrefix(this->Property, "GENEX_EVAL:"); } bool cmGeneratorExpressionDAGChecker::EvaluatingPICExpression() const { + // Corresponds to checkInterfacePropertyCompatibility's special case + // that evaluates the value of POSITION_INDEPENDENT_CODE as a genex. return this->Top->Property == "INTERFACE_POSITION_INDEPENDENT_CODE"; } diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 0114d82..1ac658c 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -547,6 +547,7 @@ static const struct TargetGenexEvalNode : public GenexEvaluator return expression; } + // Replace the surrounding context with the named target. cmGeneratorExpressionContext targetContext( context->LG, context->Config, context->Quiet, target, target, context->EvaluateForBuildsystem, context->Backtrace, context->Language); @@ -2897,6 +2898,9 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode bool evaluatingLinkLibraries = false; if (dagCheckerParent) { + // This $ node has been reached while evaluating + // another target property value. Check that the outermost evaluation + // expects such nested evaluations. if (dagCheckerParent->EvaluatingGenexExpression() || dagCheckerParent->EvaluatingPICExpression() || dagCheckerParent->EvaluatingLinkerLauncher()) { diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 2ec1a29..b32d0b8 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -6375,6 +6375,7 @@ PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt, std::string interfaceProperty = "INTERFACE_" + p; std::unique_ptr genexInterpreter; if (p == "POSITION_INDEPENDENT_CODE") { + // Corresponds to EvaluatingPICExpression. genexInterpreter = cm::make_unique( tgt->GetLocalGenerator(), config, tgt); } -- cgit v0.12