cmGeneratorExpression: Port interface to cmGeneratorTarget.
This commit is contained in:
parent
11165525ba
commit
1583440509
|
@ -457,7 +457,7 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
|
||||||
this->ReplaceInstallPrefix(dirs);
|
this->ReplaceInstallPrefix(dirs);
|
||||||
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(dirs);
|
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(dirs);
|
||||||
std::string exportDirs = cge->Evaluate(target->GetLocalGenerator(), "",
|
std::string exportDirs = cge->Evaluate(target->GetLocalGenerator(), "",
|
||||||
false, target->Target);
|
false, target);
|
||||||
|
|
||||||
if (cge->GetHadContextSensitiveCondition())
|
if (cge->GetHadContextSensitiveCondition())
|
||||||
{
|
{
|
||||||
|
|
|
@ -78,10 +78,11 @@ std::string cmExportTryCompileFileGenerator::FindTargets(
|
||||||
|
|
||||||
cmGeneratorTarget* gtgt =
|
cmGeneratorTarget* gtgt =
|
||||||
tgt->GetMakefile()->GetGlobalGenerator()->GetGeneratorTarget(tgt);
|
tgt->GetMakefile()->GetGlobalGenerator()->GetGeneratorTarget(tgt);
|
||||||
|
cmGeneratorTarget gDummyHead(&dummyHead, gtgt->GetLocalGenerator());
|
||||||
|
|
||||||
std::string result = cge->Evaluate(gtgt->GetLocalGenerator(), this->Config,
|
std::string result = cge->Evaluate(gtgt->GetLocalGenerator(), this->Config,
|
||||||
false, &dummyHead,
|
false, &gDummyHead,
|
||||||
gtgt->Target, &dagChecker);
|
gtgt, &dagChecker);
|
||||||
|
|
||||||
const std::set<cmTarget const*> &allTargets = cge->GetAllTargetsSeen();
|
const std::set<cmTarget const*> &allTargets = cge->GetAllTargetsSeen();
|
||||||
for(std::set<cmTarget const*>::const_iterator li = allTargets.begin();
|
for(std::set<cmTarget const*>::const_iterator li = allTargets.begin();
|
||||||
|
|
|
@ -50,7 +50,7 @@ cmGeneratorExpression::~cmGeneratorExpression()
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
const char *cmCompiledGeneratorExpression::Evaluate(cmLocalGenerator* lg,
|
const char *cmCompiledGeneratorExpression::Evaluate(cmLocalGenerator* lg,
|
||||||
const std::string& config, bool quiet,
|
const std::string& config, bool quiet,
|
||||||
cmTarget const* headTarget,
|
const cmGeneratorTarget* headTarget,
|
||||||
cmGeneratorExpressionDAGChecker *dagChecker,
|
cmGeneratorExpressionDAGChecker *dagChecker,
|
||||||
std::string const& language) const
|
std::string const& language) const
|
||||||
{
|
{
|
||||||
|
@ -66,8 +66,8 @@ const char *cmCompiledGeneratorExpression::Evaluate(cmLocalGenerator* lg,
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
const char *cmCompiledGeneratorExpression::Evaluate(
|
const char *cmCompiledGeneratorExpression::Evaluate(
|
||||||
cmLocalGenerator* lg, const std::string& config, bool quiet,
|
cmLocalGenerator* lg, const std::string& config, bool quiet,
|
||||||
cmTarget const* headTarget,
|
const cmGeneratorTarget* headTarget,
|
||||||
cmTarget const* currentTarget,
|
const cmGeneratorTarget* currentTarget,
|
||||||
cmGeneratorExpressionDAGChecker *dagChecker,
|
cmGeneratorExpressionDAGChecker *dagChecker,
|
||||||
std::string const& language) const
|
std::string const& language) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include <cmsys/auto_ptr.hxx>
|
#include <cmsys/auto_ptr.hxx>
|
||||||
|
|
||||||
class cmTarget;
|
class cmTarget;
|
||||||
|
class cmGeneratorTarget;
|
||||||
class cmLocalGenerator;
|
class cmLocalGenerator;
|
||||||
class cmListFileBacktrace;
|
class cmListFileBacktrace;
|
||||||
|
|
||||||
|
@ -80,13 +81,13 @@ class cmCompiledGeneratorExpression
|
||||||
public:
|
public:
|
||||||
const char* Evaluate(cmLocalGenerator* lg, const std::string& config,
|
const char* Evaluate(cmLocalGenerator* lg, const std::string& config,
|
||||||
bool quiet = false,
|
bool quiet = false,
|
||||||
cmTarget const* headTarget = 0,
|
cmGeneratorTarget const* headTarget = 0,
|
||||||
cmTarget const* currentTarget = 0,
|
cmGeneratorTarget const* currentTarget = 0,
|
||||||
cmGeneratorExpressionDAGChecker *dagChecker = 0,
|
cmGeneratorExpressionDAGChecker *dagChecker = 0,
|
||||||
std::string const& language = std::string()) const;
|
std::string const& language = std::string()) const;
|
||||||
const char* Evaluate(cmLocalGenerator* lg, const std::string& config,
|
const char* Evaluate(cmLocalGenerator* lg, const std::string& config,
|
||||||
bool quiet,
|
bool quiet,
|
||||||
cmTarget const* headTarget,
|
cmGeneratorTarget const* headTarget,
|
||||||
cmGeneratorExpressionDAGChecker *dagChecker,
|
cmGeneratorExpressionDAGChecker *dagChecker,
|
||||||
std::string const& language = std::string()) const;
|
std::string const& language = std::string()) const;
|
||||||
|
|
||||||
|
|
|
@ -11,11 +11,12 @@
|
||||||
============================================================================*/
|
============================================================================*/
|
||||||
|
|
||||||
#include "cmGeneratorExpressionContext.h"
|
#include "cmGeneratorExpressionContext.h"
|
||||||
|
#include "cmGeneratorTarget.h"
|
||||||
|
|
||||||
cmGeneratorExpressionContext::cmGeneratorExpressionContext(
|
cmGeneratorExpressionContext::cmGeneratorExpressionContext(
|
||||||
cmLocalGenerator* lg, std::string const& config,
|
cmLocalGenerator* lg, std::string const& config,
|
||||||
bool quiet, cmTarget const* headTarget,
|
bool quiet, cmGeneratorTarget const* headTarget,
|
||||||
cmTarget const* currentTarget,
|
const cmGeneratorTarget* currentTarget,
|
||||||
bool evaluateForBuildsystem,
|
bool evaluateForBuildsystem,
|
||||||
cmListFileBacktrace const& backtrace,
|
cmListFileBacktrace const& backtrace,
|
||||||
std::string const& language)
|
std::string const& language)
|
||||||
|
@ -23,8 +24,8 @@ cmGeneratorExpressionContext::cmGeneratorExpressionContext(
|
||||||
LG(lg),
|
LG(lg),
|
||||||
Config(config),
|
Config(config),
|
||||||
Language(language),
|
Language(language),
|
||||||
HeadTarget(headTarget),
|
HeadTarget(headTarget ? headTarget->Target : 0),
|
||||||
CurrentTarget(currentTarget),
|
CurrentTarget(currentTarget ? currentTarget->Target : 0),
|
||||||
Quiet(quiet),
|
Quiet(quiet),
|
||||||
HadError(false),
|
HadError(false),
|
||||||
HadContextSensitiveCondition(false),
|
HadContextSensitiveCondition(false),
|
||||||
|
|
|
@ -19,14 +19,15 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
class cmTarget;
|
class cmTarget;
|
||||||
|
class cmGeneratorTarget;
|
||||||
class cmLocalGenerator;
|
class cmLocalGenerator;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
struct cmGeneratorExpressionContext
|
struct cmGeneratorExpressionContext
|
||||||
{
|
{
|
||||||
cmGeneratorExpressionContext(cmLocalGenerator* lg, std::string const& config,
|
cmGeneratorExpressionContext(cmLocalGenerator* lg, std::string const& config,
|
||||||
bool quiet, cmTarget const* headTarget,
|
bool quiet, const cmGeneratorTarget* headTarget,
|
||||||
cmTarget const* currentTarget,
|
cmGeneratorTarget const* currentTarget,
|
||||||
bool evaluateForBuildsystem,
|
bool evaluateForBuildsystem,
|
||||||
cmListFileBacktrace const& backtrace,
|
cmListFileBacktrace const& backtrace,
|
||||||
std::string const& language);
|
std::string const& language);
|
||||||
|
|
|
@ -19,7 +19,8 @@
|
||||||
std::string cmGeneratorExpressionNode::EvaluateDependentExpression(
|
std::string cmGeneratorExpressionNode::EvaluateDependentExpression(
|
||||||
std::string const& prop, cmLocalGenerator *lg,
|
std::string const& prop, cmLocalGenerator *lg,
|
||||||
cmGeneratorExpressionContext *context,
|
cmGeneratorExpressionContext *context,
|
||||||
cmTarget const* headTarget, cmTarget const* currentTarget,
|
cmGeneratorTarget const* headTarget,
|
||||||
|
cmGeneratorTarget const* currentTarget,
|
||||||
cmGeneratorExpressionDAGChecker *dagChecker)
|
cmGeneratorExpressionDAGChecker *dagChecker)
|
||||||
{
|
{
|
||||||
cmGeneratorExpression ge(context->Backtrace);
|
cmGeneratorExpression ge(context->Backtrace);
|
||||||
|
@ -862,8 +863,8 @@ getLinkedTargetsContent(
|
||||||
cmGeneratorExpressionNode::EvaluateDependentExpression(depString,
|
cmGeneratorExpressionNode::EvaluateDependentExpression(depString,
|
||||||
target->GetLocalGenerator(),
|
target->GetLocalGenerator(),
|
||||||
context,
|
context,
|
||||||
headTarget->Target,
|
headTarget,
|
||||||
target->Target, dagChecker);
|
target, dagChecker);
|
||||||
}
|
}
|
||||||
linkedTargetsContent =
|
linkedTargetsContent =
|
||||||
cmGeneratorExpression::StripEmptyListElements(linkedTargetsContent);
|
cmGeneratorExpression::StripEmptyListElements(linkedTargetsContent);
|
||||||
|
@ -1215,9 +1216,11 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
|
||||||
}
|
}
|
||||||
if(!interfacePropertyName.empty())
|
if(!interfacePropertyName.empty())
|
||||||
{
|
{
|
||||||
|
cmGeneratorTarget* gHeadTarget =
|
||||||
|
context->LG->GetGlobalGenerator()->GetGeneratorTarget(headTarget);
|
||||||
std::string result = this->EvaluateDependentExpression(prop,
|
std::string result = this->EvaluateDependentExpression(prop,
|
||||||
context->LG, context,
|
context->LG, context,
|
||||||
headTarget, target, &dagChecker);
|
gHeadTarget, gtgt, &dagChecker);
|
||||||
if (!linkedTargetsContent.empty())
|
if (!linkedTargetsContent.empty())
|
||||||
{
|
{
|
||||||
result += (result.empty() ? "" : ";") + linkedTargetsContent;
|
result += (result.empty() ? "" : ";") + linkedTargetsContent;
|
||||||
|
|
|
@ -56,7 +56,8 @@ struct cmGeneratorExpressionNode
|
||||||
static std::string EvaluateDependentExpression(
|
static std::string EvaluateDependentExpression(
|
||||||
std::string const& prop, cmLocalGenerator *lg,
|
std::string const& prop, cmLocalGenerator *lg,
|
||||||
cmGeneratorExpressionContext *context,
|
cmGeneratorExpressionContext *context,
|
||||||
cmTarget const* headTarget, cmTarget const* currentTarget,
|
const cmGeneratorTarget* headTarget,
|
||||||
|
const cmGeneratorTarget* currentTarget,
|
||||||
cmGeneratorExpressionDAGChecker *dagChecker);
|
cmGeneratorExpressionDAGChecker *dagChecker);
|
||||||
|
|
||||||
static const cmGeneratorExpressionNode* GetNode(
|
static const cmGeneratorExpressionNode* GetNode(
|
||||||
|
|
|
@ -524,8 +524,8 @@ static void handleSystemIncludesDep(cmLocalGenerator *lg,
|
||||||
cmGeneratorExpression ge;
|
cmGeneratorExpression ge;
|
||||||
cmSystemTools::ExpandListArgument(ge.Parse(dirs)
|
cmSystemTools::ExpandListArgument(ge.Parse(dirs)
|
||||||
->Evaluate(lg,
|
->Evaluate(lg,
|
||||||
config, false, headTarget->Target,
|
config, false, headTarget,
|
||||||
depTgt->Target, dagChecker), result);
|
depTgt, dagChecker), result);
|
||||||
}
|
}
|
||||||
if (!depTgt->IsImported() || excludeImported)
|
if (!depTgt->IsImported() || excludeImported)
|
||||||
{
|
{
|
||||||
|
@ -538,8 +538,8 @@ static void handleSystemIncludesDep(cmLocalGenerator *lg,
|
||||||
cmGeneratorExpression ge;
|
cmGeneratorExpression ge;
|
||||||
cmSystemTools::ExpandListArgument(ge.Parse(dirs)
|
cmSystemTools::ExpandListArgument(ge.Parse(dirs)
|
||||||
->Evaluate(lg,
|
->Evaluate(lg,
|
||||||
config, false, headTarget->Target,
|
config, false, headTarget,
|
||||||
depTgt->Target, dagChecker), result);
|
depTgt, dagChecker), result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -880,7 +880,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const std::string& dir,
|
||||||
cmGeneratorExpression ge;
|
cmGeneratorExpression ge;
|
||||||
cmSystemTools::ExpandListArgument(ge.Parse(*it)
|
cmSystemTools::ExpandListArgument(ge.Parse(*it)
|
||||||
->Evaluate(this->LocalGenerator,
|
->Evaluate(this->LocalGenerator,
|
||||||
config, false, this->Target,
|
config, false, this,
|
||||||
&dagChecker), result);
|
&dagChecker), result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -889,8 +889,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const std::string& dir,
|
||||||
for(std::vector<cmGeneratorTarget const*>::const_iterator
|
for(std::vector<cmGeneratorTarget const*>::const_iterator
|
||||||
li = deps.begin(), le = deps.end(); li != le; ++li)
|
li = deps.begin(), le = deps.end(); li != le; ++li)
|
||||||
{
|
{
|
||||||
handleSystemIncludesDep(this->LocalGenerator, *li,
|
handleSystemIncludesDep(this->LocalGenerator, *li, config, this,
|
||||||
config, this,
|
|
||||||
&dagChecker, result, excludeImported);
|
&dagChecker, result, excludeImported);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -966,8 +965,8 @@ static bool processSources(cmGeneratorTarget const* tgt,
|
||||||
tgt->GetLocalGenerator(),
|
tgt->GetLocalGenerator(),
|
||||||
config,
|
config,
|
||||||
false,
|
false,
|
||||||
tgt->Target,
|
tgt,
|
||||||
tgt->Target,
|
tgt,
|
||||||
dagChecker),
|
dagChecker),
|
||||||
entrySources);
|
entrySources);
|
||||||
|
|
||||||
|
@ -2059,7 +2058,7 @@ void cmGeneratorTarget::GetAutoUicOptions(std::vector<std::string> &result,
|
||||||
->Evaluate(this->LocalGenerator,
|
->Evaluate(this->LocalGenerator,
|
||||||
config,
|
config,
|
||||||
false,
|
false,
|
||||||
this->Target,
|
this,
|
||||||
&dagChecker),
|
&dagChecker),
|
||||||
result);
|
result);
|
||||||
}
|
}
|
||||||
|
@ -2544,7 +2543,7 @@ static void processIncludeDirectories(cmGeneratorTarget const* tgt,
|
||||||
tgt->GetLocalGenerator(),
|
tgt->GetLocalGenerator(),
|
||||||
config,
|
config,
|
||||||
false,
|
false,
|
||||||
tgt->Target,
|
tgt,
|
||||||
dagChecker, language),
|
dagChecker, language),
|
||||||
entryIncludes);
|
entryIncludes);
|
||||||
|
|
||||||
|
@ -2755,7 +2754,7 @@ static void processCompileOptionsInternal(cmGeneratorTarget const* tgt,
|
||||||
tgt->GetLocalGenerator(),
|
tgt->GetLocalGenerator(),
|
||||||
config,
|
config,
|
||||||
false,
|
false,
|
||||||
tgt->Target,
|
tgt,
|
||||||
dagChecker,
|
dagChecker,
|
||||||
language),
|
language),
|
||||||
entryOptions);
|
entryOptions);
|
||||||
|
@ -4455,8 +4454,8 @@ void cmGeneratorTarget::ExpandLinkItems(std::string const& prop,
|
||||||
this->LocalGenerator,
|
this->LocalGenerator,
|
||||||
config,
|
config,
|
||||||
false,
|
false,
|
||||||
headTarget->Target,
|
headTarget,
|
||||||
this->Target, &dagChecker), libs);
|
this, &dagChecker), libs);
|
||||||
this->LookupLinkItems(libs, items);
|
this->LookupLinkItems(libs, items);
|
||||||
hadHeadSensitiveCondition = cge->GetHadHeadSensitiveCondition();
|
hadHeadSensitiveCondition = cge->GetHadHeadSensitiveCondition();
|
||||||
}
|
}
|
||||||
|
@ -5347,8 +5346,7 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
|
||||||
cmsys::auto_ptr<cmCompiledGeneratorExpression> const cge =
|
cmsys::auto_ptr<cmCompiledGeneratorExpression> const cge =
|
||||||
ge.Parse(*le);
|
ge.Parse(*le);
|
||||||
std::string const evaluated =
|
std::string const evaluated =
|
||||||
cge->Evaluate(this->LocalGenerator, config, false,
|
cge->Evaluate(this->LocalGenerator, config, false, head, &dagChecker);
|
||||||
head->Target, &dagChecker);
|
|
||||||
cmSystemTools::ExpandListArgument(evaluated, llibs);
|
cmSystemTools::ExpandListArgument(evaluated, llibs);
|
||||||
if(cge->GetHadHeadSensitiveCondition())
|
if(cge->GetHadHeadSensitiveCondition())
|
||||||
{
|
{
|
||||||
|
|
|
@ -149,7 +149,9 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
|
||||||
|
|
||||||
cmSystemTools::ExpandListArgument(cge->Evaluate(this->LocalGenerator,
|
cmSystemTools::ExpandListArgument(cge->Evaluate(this->LocalGenerator,
|
||||||
config,
|
config,
|
||||||
false, this->Target, 0, 0),
|
false,
|
||||||
|
this->GeneratorTarget,
|
||||||
|
0, 0),
|
||||||
this->CleanFiles);
|
this->CleanFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue