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.
This commit is contained in:
Stephen Kelly 2013-02-09 11:12:20 +01:00 committed by Brad King
parent 0ad58af444
commit f2ab17d4db
4 changed files with 13 additions and 5 deletions

View File

@ -114,7 +114,8 @@ const char *cmCompiledGeneratorExpression::Evaluate(
this->HadContextSensitiveCondition = context.HadContextSensitiveCondition; this->HadContextSensitiveCondition = context.HadContextSensitiveCondition;
} }
this->Targets = context.Targets; this->DependTargets = context.DependTargets;
this->AllTargetsSeen = context.AllTargets;
// TODO: Return a std::string from here instead? // TODO: Return a std::string from here instead?
return this->Output.c_str(); return this->Output.c_str();
} }

View File

@ -88,11 +88,14 @@ public:
/** Get set of targets found during evaluations. */ /** Get set of targets found during evaluations. */
std::set<cmTarget*> const& GetTargets() const std::set<cmTarget*> const& GetTargets() const
{ return this->Targets; } { return this->DependTargets; }
std::set<cmStdString> const& GetSeenTargetProperties() const std::set<cmStdString> const& GetSeenTargetProperties() const
{ return this->SeenTargetProperties; } { return this->SeenTargetProperties; }
std::set<cmTarget*> const& GetAllTargetsSeen() const
{ return this->AllTargetsSeen; }
~cmCompiledGeneratorExpression(); ~cmCompiledGeneratorExpression();
std::string GetInput() const std::string GetInput() const
@ -123,7 +126,8 @@ private:
const std::string Input; const std::string Input;
bool NeedsParsing; bool NeedsParsing;
mutable std::set<cmTarget*> Targets; mutable std::set<cmTarget*> DependTargets;
mutable std::set<cmTarget*> AllTargetsSeen;
mutable std::set<cmStdString> SeenTargetProperties; mutable std::set<cmStdString> SeenTargetProperties;
mutable std::string Output; mutable std::string Output;
mutable bool HadContextSensitiveCondition; mutable bool HadContextSensitiveCondition;

View File

@ -392,6 +392,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
reportError(context, content->GetOriginalExpression(), e.str()); reportError(context, content->GetOriginalExpression(), e.str());
return std::string(); return std::string();
} }
context->AllTargets.insert(target);
} }
if (target == context->HeadTarget) if (target == context->HeadTarget)
@ -852,7 +853,8 @@ struct TargetFilesystemArtifact : public cmGeneratorExpressionNode
"Target \"" + name + "\" is not an executable or library."); "Target \"" + name + "\" is not an executable or library.");
return std::string(); return std::string();
} }
context->Targets.insert(target); context->DependTargets.insert(target);
context->AllTargets.insert(target);
std::string result = std::string result =
TargetFilesystemArtifactResultCreator<linker, soname>::Create( TargetFilesystemArtifactResultCreator<linker, soname>::Create(

View File

@ -23,7 +23,8 @@ class cmTarget;
struct cmGeneratorExpressionContext struct cmGeneratorExpressionContext
{ {
cmListFileBacktrace Backtrace; cmListFileBacktrace Backtrace;
std::set<cmTarget*> Targets; std::set<cmTarget*> DependTargets;
std::set<cmTarget*> AllTargets;
std::set<cmStdString> SeenTargetProperties; std::set<cmStdString> SeenTargetProperties;
cmMakefile *Makefile; cmMakefile *Makefile;
const char *Config; const char *Config;