Commit f2ab17d4 authored by Stephen Kelly's avatar Stephen Kelly Committed by Brad King
Browse files

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.
parent 0ad58af4
......@@ -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();
}
......
......@@ -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;
......
......@@ -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(
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment