cmMakefile: Split accessors for compile definitions and origins.

This commit is contained in:
Stephen Kelly 2015-07-08 23:11:22 +02:00
parent ef17bbefd7
commit d6239507b2
5 changed files with 24 additions and 21 deletions

View File

@ -1417,8 +1417,10 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo()
{ {
cmMakefile *mf = this->LocalGenerators[i]->GetMakefile(); cmMakefile *mf = this->LocalGenerators[i]->GetMakefile();
const std::vector<cmValueWithOrigin> noconfig_compile_definitions = const std::vector<std::string> noconfig_compile_definitions =
mf->GetCompileDefinitionsEntries(); mf->GetCompileDefinitionsEntries();
const std::vector<cmListFileBacktrace> noconfig_compile_definitions_bts =
mf->GetCompileDefinitionsBacktraces();
cmTargets& targets = mf->GetTargets(); cmTargets& targets = mf->GetTargets();
for(cmTargets::iterator ti = targets.begin(); for(cmTargets::iterator ti = targets.begin();
@ -1433,11 +1435,13 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo()
continue; continue;
} }
for (std::vector<cmValueWithOrigin>::const_iterator it std::vector<cmListFileBacktrace>::const_iterator btIt
= noconfig_compile_definitions_bts.begin();
for (std::vector<std::string>::const_iterator it
= noconfig_compile_definitions.begin(); = noconfig_compile_definitions.begin();
it != noconfig_compile_definitions.end(); ++it) it != noconfig_compile_definitions.end(); ++it, ++btIt)
{ {
t->InsertCompileDefinition(*it); t->InsertCompileDefinition(*it, *btIt);
} }
cmPolicies::PolicyStatus polSt cmPolicies::PolicyStatus polSt

View File

@ -303,19 +303,15 @@ std::vector<cmValueWithOrigin> cmMakefile::GetCompileOptionsEntries() const
return entries; return entries;
} }
std::vector<cmValueWithOrigin> cmMakefile::GetCompileDefinitionsEntries() const std::vector<std::string> cmMakefile::GetCompileDefinitionsEntries() const
{ {
std::vector<cmValueWithOrigin> entries; return this->CompileDefinitionsEntries;
entries.reserve(this->CompileDefinitionsEntries.size()); }
std::vector<cmListFileBacktrace>::const_iterator btIt =
this->CompileDefinitionsEntryBacktraces.begin(); std::vector<cmListFileBacktrace>
for(std::vector<std::string>::const_iterator it = cmMakefile::GetCompileDefinitionsBacktraces() const
this->CompileDefinitionsEntries.begin(); {
it != this->CompileDefinitionsEntries.end(); ++it, ++btIt) return this->CompileDefinitionsEntryBacktraces;
{
entries.push_back(cmValueWithOrigin(*it, *btIt));
}
return entries;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -748,7 +748,8 @@ public:
std::vector<cmValueWithOrigin> GetIncludeDirectoriesEntries() const; std::vector<cmValueWithOrigin> GetIncludeDirectoriesEntries() const;
std::vector<cmValueWithOrigin> GetCompileOptionsEntries() const; std::vector<cmValueWithOrigin> GetCompileOptionsEntries() const;
std::vector<cmValueWithOrigin> GetCompileDefinitionsEntries() const; std::vector<std::string> GetCompileDefinitionsEntries() const;
std::vector<cmListFileBacktrace> GetCompileDefinitionsBacktraces() const;
bool IsConfigured() const { return this->Configured; } bool IsConfigured() const { return this->Configured; }
void SetConfigured(){ this->Configured = true; } void SetConfigured(){ this->Configured = true; }

View File

@ -1954,12 +1954,13 @@ void cmTarget::InsertCompileOption(const cmValueWithOrigin &entry,
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmTarget::InsertCompileDefinition(const cmValueWithOrigin &entry) void cmTarget::InsertCompileDefinition(std::string const& entry,
cmListFileBacktrace const& bt)
{ {
cmGeneratorExpression ge(entry.Backtrace); cmGeneratorExpression ge(bt);
this->Internal->CompileDefinitionsEntries.push_back( this->Internal->CompileDefinitionsEntries.push_back(
new cmTargetInternals::TargetPropertyEntry(ge.Parse(entry.Value))); new cmTargetInternals::TargetPropertyEntry(ge.Parse(entry)));
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -576,7 +576,8 @@ public:
bool before = false); bool before = false);
void InsertCompileOption(const cmValueWithOrigin &entry, void InsertCompileOption(const cmValueWithOrigin &entry,
bool before = false); bool before = false);
void InsertCompileDefinition(const cmValueWithOrigin &entry); void InsertCompileDefinition(std::string const& entry,
cmListFileBacktrace const& bt);
void AppendBuildInterfaceIncludes(); void AppendBuildInterfaceIncludes();