From f2ab17d4db86af5695f70b5c49f388319e510472 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 9 Feb 2013 11:12:20 +0100 Subject: [PATCH] Keep track of all targets seen while evaluating a genex. As dependencies of the generator expression, these will re-exported in try_compile generated code. --- Source/cmGeneratorExpression.cxx | 3 ++- Source/cmGeneratorExpression.h | 8 ++++++-- Source/cmGeneratorExpressionEvaluator.cxx | 4 +++- Source/cmGeneratorExpressionEvaluator.h | 3 ++- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index 5d162fe03..51ebddb93 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -114,7 +114,8 @@ const char *cmCompiledGeneratorExpression::Evaluate( this->HadContextSensitiveCondition = context.HadContextSensitiveCondition; } - this->Targets = context.Targets; + this->DependTargets = context.DependTargets; + this->AllTargetsSeen = context.AllTargets; // TODO: Return a std::string from here instead? return this->Output.c_str(); } diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index 489b052e9..e22303497 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -88,11 +88,14 @@ public: /** Get set of targets found during evaluations. */ std::set const& GetTargets() const - { return this->Targets; } + { return this->DependTargets; } std::set const& GetSeenTargetProperties() const { return this->SeenTargetProperties; } + std::set const& GetAllTargetsSeen() const + { return this->AllTargetsSeen; } + ~cmCompiledGeneratorExpression(); std::string GetInput() const @@ -123,7 +126,8 @@ private: const std::string Input; bool NeedsParsing; - mutable std::set Targets; + mutable std::set DependTargets; + mutable std::set AllTargetsSeen; mutable std::set SeenTargetProperties; mutable std::string Output; mutable bool HadContextSensitiveCondition; diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index cd6a40b8d..97ba52408 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -392,6 +392,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode reportError(context, content->GetOriginalExpression(), e.str()); return std::string(); } + context->AllTargets.insert(target); } if (target == context->HeadTarget) @@ -852,7 +853,8 @@ struct TargetFilesystemArtifact : public cmGeneratorExpressionNode "Target \"" + name + "\" is not an executable or library."); return std::string(); } - context->Targets.insert(target); + context->DependTargets.insert(target); + context->AllTargets.insert(target); std::string result = TargetFilesystemArtifactResultCreator::Create( diff --git a/Source/cmGeneratorExpressionEvaluator.h b/Source/cmGeneratorExpressionEvaluator.h index 37d5c864f..ce7ad69bb 100644 --- a/Source/cmGeneratorExpressionEvaluator.h +++ b/Source/cmGeneratorExpressionEvaluator.h @@ -23,7 +23,8 @@ class cmTarget; struct cmGeneratorExpressionContext { cmListFileBacktrace Backtrace; - std::set Targets; + std::set DependTargets; + std::set AllTargets; std::set SeenTargetProperties; cmMakefile *Makefile; const char *Config;