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->Targets = context.Targets;
this->DependTargets = context.DependTargets;
this->AllTargetsSeen = context.AllTargets;
// TODO: Return a std::string from here instead?
return this->Output.c_str();
}

View File

@ -88,11 +88,14 @@ public:
/** Get set of targets found during evaluations. */
std::set<cmTarget*> const& GetTargets() const
{ return this->Targets; }
{ return this->DependTargets; }
std::set<cmStdString> const& GetSeenTargetProperties() const
{ return this->SeenTargetProperties; }
std::set<cmTarget*> 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<cmTarget*> Targets;
mutable std::set<cmTarget*> DependTargets;
mutable std::set<cmTarget*> AllTargetsSeen;
mutable std::set<cmStdString> SeenTargetProperties;
mutable std::string Output;
mutable bool HadContextSensitiveCondition;

View File

@ -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<linker, soname>::Create(

View File

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