cmGeneratorExpression: Port interface to cmGeneratorTarget.

This commit is contained in:
Stephen Kelly 2015-09-16 04:38:52 +02:00
parent 11165525ba
commit 1583440509
10 changed files with 45 additions and 37 deletions

View File

@ -457,7 +457,7 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
this->ReplaceInstallPrefix(dirs);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(dirs);
std::string exportDirs = cge->Evaluate(target->GetLocalGenerator(), "",
false, target->Target);
false, target);
if (cge->GetHadContextSensitiveCondition())
{

View File

@ -78,10 +78,11 @@ std::string cmExportTryCompileFileGenerator::FindTargets(
cmGeneratorTarget* gtgt =
tgt->GetMakefile()->GetGlobalGenerator()->GetGeneratorTarget(tgt);
cmGeneratorTarget gDummyHead(&dummyHead, gtgt->GetLocalGenerator());
std::string result = cge->Evaluate(gtgt->GetLocalGenerator(), this->Config,
false, &dummyHead,
gtgt->Target, &dagChecker);
false, &gDummyHead,
gtgt, &dagChecker);
const std::set<cmTarget const*> &allTargets = cge->GetAllTargetsSeen();
for(std::set<cmTarget const*>::const_iterator li = allTargets.begin();

View File

@ -50,7 +50,7 @@ cmGeneratorExpression::~cmGeneratorExpression()
//----------------------------------------------------------------------------
const char *cmCompiledGeneratorExpression::Evaluate(cmLocalGenerator* lg,
const std::string& config, bool quiet,
cmTarget const* headTarget,
const cmGeneratorTarget* headTarget,
cmGeneratorExpressionDAGChecker *dagChecker,
std::string const& language) const
{
@ -66,8 +66,8 @@ const char *cmCompiledGeneratorExpression::Evaluate(cmLocalGenerator* lg,
//----------------------------------------------------------------------------
const char *cmCompiledGeneratorExpression::Evaluate(
cmLocalGenerator* lg, const std::string& config, bool quiet,
cmTarget const* headTarget,
cmTarget const* currentTarget,
const cmGeneratorTarget* headTarget,
const cmGeneratorTarget* currentTarget,
cmGeneratorExpressionDAGChecker *dagChecker,
std::string const& language) const
{

View File

@ -20,6 +20,7 @@
#include <cmsys/auto_ptr.hxx>
class cmTarget;
class cmGeneratorTarget;
class cmLocalGenerator;
class cmListFileBacktrace;
@ -80,13 +81,13 @@ class cmCompiledGeneratorExpression
public:
const char* Evaluate(cmLocalGenerator* lg, const std::string& config,
bool quiet = false,
cmTarget const* headTarget = 0,
cmTarget const* currentTarget = 0,
cmGeneratorTarget const* headTarget = 0,
cmGeneratorTarget const* currentTarget = 0,
cmGeneratorExpressionDAGChecker *dagChecker = 0,
std::string const& language = std::string()) const;
const char* Evaluate(cmLocalGenerator* lg, const std::string& config,
bool quiet,
cmTarget const* headTarget,
cmGeneratorTarget const* headTarget,
cmGeneratorExpressionDAGChecker *dagChecker,
std::string const& language = std::string()) const;

View File

@ -11,11 +11,12 @@
============================================================================*/
#include "cmGeneratorExpressionContext.h"
#include "cmGeneratorTarget.h"
cmGeneratorExpressionContext::cmGeneratorExpressionContext(
cmLocalGenerator* lg, std::string const& config,
bool quiet, cmTarget const* headTarget,
cmTarget const* currentTarget,
bool quiet, cmGeneratorTarget const* headTarget,
const cmGeneratorTarget* currentTarget,
bool evaluateForBuildsystem,
cmListFileBacktrace const& backtrace,
std::string const& language)
@ -23,8 +24,8 @@ cmGeneratorExpressionContext::cmGeneratorExpressionContext(
LG(lg),
Config(config),
Language(language),
HeadTarget(headTarget),
CurrentTarget(currentTarget),
HeadTarget(headTarget ? headTarget->Target : 0),
CurrentTarget(currentTarget ? currentTarget->Target : 0),
Quiet(quiet),
HadError(false),
HadContextSensitiveCondition(false),

View File

@ -19,14 +19,15 @@
#include <string>
class cmTarget;
class cmGeneratorTarget;
class cmLocalGenerator;
//----------------------------------------------------------------------------
struct cmGeneratorExpressionContext
{
cmGeneratorExpressionContext(cmLocalGenerator* lg, std::string const& config,
bool quiet, cmTarget const* headTarget,
cmTarget const* currentTarget,
bool quiet, const cmGeneratorTarget* headTarget,
cmGeneratorTarget const* currentTarget,
bool evaluateForBuildsystem,
cmListFileBacktrace const& backtrace,
std::string const& language);

View File

@ -19,7 +19,8 @@
std::string cmGeneratorExpressionNode::EvaluateDependentExpression(
std::string const& prop, cmLocalGenerator *lg,
cmGeneratorExpressionContext *context,
cmTarget const* headTarget, cmTarget const* currentTarget,
cmGeneratorTarget const* headTarget,
cmGeneratorTarget const* currentTarget,
cmGeneratorExpressionDAGChecker *dagChecker)
{
cmGeneratorExpression ge(context->Backtrace);
@ -862,8 +863,8 @@ getLinkedTargetsContent(
cmGeneratorExpressionNode::EvaluateDependentExpression(depString,
target->GetLocalGenerator(),
context,
headTarget->Target,
target->Target, dagChecker);
headTarget,
target, dagChecker);
}
linkedTargetsContent =
cmGeneratorExpression::StripEmptyListElements(linkedTargetsContent);
@ -1215,9 +1216,11 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
}
if(!interfacePropertyName.empty())
{
cmGeneratorTarget* gHeadTarget =
context->LG->GetGlobalGenerator()->GetGeneratorTarget(headTarget);
std::string result = this->EvaluateDependentExpression(prop,
context->LG, context,
headTarget, target, &dagChecker);
gHeadTarget, gtgt, &dagChecker);
if (!linkedTargetsContent.empty())
{
result += (result.empty() ? "" : ";") + linkedTargetsContent;

View File

@ -56,7 +56,8 @@ struct cmGeneratorExpressionNode
static std::string EvaluateDependentExpression(
std::string const& prop, cmLocalGenerator *lg,
cmGeneratorExpressionContext *context,
cmTarget const* headTarget, cmTarget const* currentTarget,
const cmGeneratorTarget* headTarget,
const cmGeneratorTarget* currentTarget,
cmGeneratorExpressionDAGChecker *dagChecker);
static const cmGeneratorExpressionNode* GetNode(

View File

@ -524,8 +524,8 @@ static void handleSystemIncludesDep(cmLocalGenerator *lg,
cmGeneratorExpression ge;
cmSystemTools::ExpandListArgument(ge.Parse(dirs)
->Evaluate(lg,
config, false, headTarget->Target,
depTgt->Target, dagChecker), result);
config, false, headTarget,
depTgt, dagChecker), result);
}
if (!depTgt->IsImported() || excludeImported)
{
@ -538,8 +538,8 @@ static void handleSystemIncludesDep(cmLocalGenerator *lg,
cmGeneratorExpression ge;
cmSystemTools::ExpandListArgument(ge.Parse(dirs)
->Evaluate(lg,
config, false, headTarget->Target,
depTgt->Target, dagChecker), result);
config, false, headTarget,
depTgt, dagChecker), result);
}
}
@ -880,7 +880,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const std::string& dir,
cmGeneratorExpression ge;
cmSystemTools::ExpandListArgument(ge.Parse(*it)
->Evaluate(this->LocalGenerator,
config, false, this->Target,
config, false, this,
&dagChecker), result);
}
@ -889,8 +889,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const std::string& dir,
for(std::vector<cmGeneratorTarget const*>::const_iterator
li = deps.begin(), le = deps.end(); li != le; ++li)
{
handleSystemIncludesDep(this->LocalGenerator, *li,
config, this,
handleSystemIncludesDep(this->LocalGenerator, *li, config, this,
&dagChecker, result, excludeImported);
}
@ -966,8 +965,8 @@ static bool processSources(cmGeneratorTarget const* tgt,
tgt->GetLocalGenerator(),
config,
false,
tgt->Target,
tgt->Target,
tgt,
tgt,
dagChecker),
entrySources);
@ -2059,7 +2058,7 @@ void cmGeneratorTarget::GetAutoUicOptions(std::vector<std::string> &result,
->Evaluate(this->LocalGenerator,
config,
false,
this->Target,
this,
&dagChecker),
result);
}
@ -2544,7 +2543,7 @@ static void processIncludeDirectories(cmGeneratorTarget const* tgt,
tgt->GetLocalGenerator(),
config,
false,
tgt->Target,
tgt,
dagChecker, language),
entryIncludes);
@ -2755,7 +2754,7 @@ static void processCompileOptionsInternal(cmGeneratorTarget const* tgt,
tgt->GetLocalGenerator(),
config,
false,
tgt->Target,
tgt,
dagChecker,
language),
entryOptions);
@ -4455,8 +4454,8 @@ void cmGeneratorTarget::ExpandLinkItems(std::string const& prop,
this->LocalGenerator,
config,
false,
headTarget->Target,
this->Target, &dagChecker), libs);
headTarget,
this, &dagChecker), libs);
this->LookupLinkItems(libs, items);
hadHeadSensitiveCondition = cge->GetHadHeadSensitiveCondition();
}
@ -5347,8 +5346,7 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
cmsys::auto_ptr<cmCompiledGeneratorExpression> const cge =
ge.Parse(*le);
std::string const evaluated =
cge->Evaluate(this->LocalGenerator, config, false,
head->Target, &dagChecker);
cge->Evaluate(this->LocalGenerator, config, false, head, &dagChecker);
cmSystemTools::ExpandListArgument(evaluated, llibs);
if(cge->GetHadHeadSensitiveCondition())
{

View File

@ -149,7 +149,9 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
cmSystemTools::ExpandListArgument(cge->Evaluate(this->LocalGenerator,
config,
false, this->Target, 0, 0),
false,
this->GeneratorTarget,
0, 0),
this->CleanFiles);
}