diff options
Diffstat (limited to 'Source/cmGeneratorExpressionEvaluator.cxx')
-rw-r--r-- | Source/cmGeneratorExpressionEvaluator.cxx | 84 |
1 files changed, 47 insertions, 37 deletions
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 67a1a6d..17adad7 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -69,9 +69,42 @@ struct cmGeneratorExpressionNode const GeneratorExpressionContent *content, cmGeneratorExpressionDAGChecker *dagChecker ) const = 0; + + static std::string EvaluateDependentExpression( + std::string const& prop, cmMakefile *makefile, + cmGeneratorExpressionContext *context, + cmTarget const* headTarget, cmTarget const* currentTarget, + cmGeneratorExpressionDAGChecker *dagChecker); }; //---------------------------------------------------------------------------- +std::string cmGeneratorExpressionNode::EvaluateDependentExpression( + std::string const& prop, cmMakefile *makefile, + cmGeneratorExpressionContext *context, + cmTarget const* headTarget, cmTarget const* currentTarget, + cmGeneratorExpressionDAGChecker *dagChecker) +{ + cmGeneratorExpression ge(&context->Backtrace); + cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop); + cge->SetEvaluateForBuildsystem(context->EvaluateForBuildsystem); + std::string result = cge->Evaluate(makefile, + context->Config, + context->Quiet, + headTarget, + currentTarget, + dagChecker); + if (cge->GetHadContextSensitiveCondition()) + { + context->HadContextSensitiveCondition = true; + } + if (cge->GetHadHeadSensitiveCondition()) + { + context->HadHeadSensitiveCondition = true; + } + return result; +} + +//---------------------------------------------------------------------------- static const struct ZeroNode : public cmGeneratorExpressionNode { ZeroNode() {} @@ -329,7 +362,7 @@ static const struct MakeCIdentifierNode : public cmGeneratorExpressionNode const GeneratorExpressionContent *, cmGeneratorExpressionDAGChecker *) const { - return cmSystemTools::MakeCidentifier(parameters.front().c_str()); + return cmSystemTools::MakeCidentifier(parameters.front()); } } makeCIdentifierNode; @@ -825,22 +858,10 @@ getLinkedTargetsContent( } if(!depString.empty()) { - cmGeneratorExpression ge(&context->Backtrace); - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(depString); - linkedTargetsContent = cge->Evaluate(target->GetMakefile(), - context->Config, - context->Quiet, - headTarget, - target, - dagChecker); - if (cge->GetHadContextSensitiveCondition()) - { - context->HadContextSensitiveCondition = true; - } - if (cge->GetHadHeadSensitiveCondition()) - { - context->HadHeadSensitiveCondition = true; - } + linkedTargetsContent = + cmGeneratorExpressionNode::EvaluateDependentExpression(depString, + target->GetMakefile(), context, + headTarget, target, dagChecker); } linkedTargetsContent = cmGeneratorExpression::StripEmptyListElements(linkedTargetsContent); @@ -939,7 +960,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode reportError(context, content->GetOriginalExpression(), e.str()); return std::string(); } - context->AllTargets.insert(target); + context->AllTargets.insert(target); } if (target == context->HeadTarget) @@ -950,6 +971,10 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode // value for all evaluations. context->SeenTargetProperties.insert(propertyName); } + if (propertyName == "SOURCES") + { + context->SourceSensitiveTargets.insert(target); + } if (propertyName.empty()) { @@ -1181,24 +1206,9 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode } if(!interfacePropertyName.empty()) { - cmGeneratorExpression ge(&context->Backtrace); - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop); - cge->SetEvaluateForBuildsystem(context->EvaluateForBuildsystem); - std::string result = cge->Evaluate(context->Makefile, - context->Config, - context->Quiet, - headTarget, - target, - &dagChecker); - - if (cge->GetHadContextSensitiveCondition()) - { - context->HadContextSensitiveCondition = true; - } - if (cge->GetHadHeadSensitiveCondition()) - { - context->HadHeadSensitiveCondition = true; - } + std::string result = this->EvaluateDependentExpression(prop, + context->Makefile, context, + headTarget, target, &dagChecker); if (!linkedTargetsContent.empty()) { result += (result.empty() ? "" : ";") + linkedTargetsContent; @@ -1253,7 +1263,7 @@ static const struct TargetObjectsNode : public cmGeneratorExpressionNode std::string tgtName = parameters.front(); cmGeneratorTarget* gt = - context->Makefile->FindGeneratorTargetToUse(tgtName.c_str()); + context->Makefile->FindGeneratorTargetToUse(tgtName); if (!gt) { cmOStringStream e; |