cmMakefile: Split accessors for include directories and origins.

This commit is contained in:
Stephen Kelly 2015-07-08 23:35:01 +02:00
parent b2de25aded
commit c7b39d06f9
5 changed files with 31 additions and 29 deletions

View File

@ -273,21 +273,18 @@ void cmMakefile::IssueMessage(cmake::MessageType t,
}
}
std::vector<cmValueWithOrigin> cmMakefile::GetIncludeDirectoriesEntries() const
std::vector<std::string> cmMakefile::GetIncludeDirectoriesEntries() const
{
std::vector<cmValueWithOrigin> entries;
entries.reserve(this->IncludeDirectoriesEntries.size());
std::vector<cmListFileBacktrace>::const_iterator btIt =
this->IncludeDirectoriesEntryBacktraces.begin();
for(std::vector<std::string>::const_iterator it =
this->IncludeDirectoriesEntries.begin();
it != this->IncludeDirectoriesEntries.end(); ++it, ++btIt)
{
entries.push_back(cmValueWithOrigin(*it, *btIt));
}
return entries;
return this->IncludeDirectoriesEntries;
}
std::vector<cmListFileBacktrace>
cmMakefile::GetIncludeDirectoriesBacktraces() const
{
return this->IncludeDirectoriesEntryBacktraces;
}
std::vector<std::string> cmMakefile::GetCompileOptionsEntries() const
{
return this->CompileOptionsEntries;
@ -1942,7 +1939,6 @@ void cmMakefile::AddIncludeDirectories(const std::vector<std::string> &incs,
cmListFileBacktrace lfbt = this->GetBacktrace();
std::string entryString = cmJoin(incs, ";");
cmValueWithOrigin entry(entryString, lfbt);
this->IncludeDirectoriesEntries.insert(position, entryString);
this->IncludeDirectoriesEntryBacktraces.insert(btPos, lfbt);
@ -1951,7 +1947,7 @@ void cmMakefile::AddIncludeDirectories(const std::vector<std::string> &incs,
l != this->Targets.end(); ++l)
{
cmTarget &t = l->second;
t.InsertInclude(entry, before);
t.InsertInclude(entryString, lfbt, before);
}
}

View File

@ -746,7 +746,8 @@ public:
/** Set whether or not to report a CMP0000 violation. */
void SetCheckCMP0000(bool b) { this->CheckCMP0000 = b; }
std::vector<cmValueWithOrigin> GetIncludeDirectoriesEntries() const;
std::vector<std::string> GetIncludeDirectoriesEntries() const;
std::vector<cmListFileBacktrace> GetIncludeDirectoriesBacktraces() const;
std::vector<std::string> GetCompileOptionsEntries() const;
std::vector<cmListFileBacktrace> GetCompileOptionsBacktraces() const;
std::vector<std::string> GetCompileDefinitionsEntries() const;

View File

@ -402,13 +402,18 @@ void cmTarget::SetMakefile(cmMakefile* mf)
{
// Initialize the INCLUDE_DIRECTORIES property based on the current value
// of the same directory property:
const std::vector<cmValueWithOrigin> parentIncludes =
const std::vector<std::string> parentIncludes =
this->Makefile->GetIncludeDirectoriesEntries();
const std::vector<cmListFileBacktrace> parentIncludesBts =
this->Makefile->GetIncludeDirectoriesBacktraces();
for (std::vector<cmValueWithOrigin>::const_iterator it
= parentIncludes.begin(); it != parentIncludes.end(); ++it)
std::vector<cmListFileBacktrace>::const_iterator btIt =
parentIncludesBts.begin();
for (std::vector<std::string>::const_iterator it
= parentIncludes.begin();
it != parentIncludes.end(); ++it, ++btIt)
{
this->InsertInclude(*it);
this->InsertInclude(*it, *btIt);
}
const std::set<std::string> parentSystemIncludes =
this->Makefile->GetSystemIncludeDirectories();
@ -421,8 +426,7 @@ void cmTarget::SetMakefile(cmMakefile* mf)
const std::vector<cmListFileBacktrace> parentOptionsBts =
this->Makefile->GetCompileOptionsBacktraces();
std::vector<cmListFileBacktrace>::const_iterator btIt =
parentOptionsBts.begin();
btIt = parentOptionsBts.begin();
for (std::vector<std::string>::const_iterator it
= parentOptions.begin();
it != parentOptions.end(); ++it, ++btIt)
@ -1931,17 +1935,18 @@ void cmTarget::AppendBuildInterfaceIncludes()
}
//----------------------------------------------------------------------------
void cmTarget::InsertInclude(const cmValueWithOrigin &entry,
void cmTarget::InsertInclude(std::string const& entry,
cmListFileBacktrace const& bt,
bool before)
{
cmGeneratorExpression ge(entry.Backtrace);
cmGeneratorExpression ge(bt);
std::vector<cmTargetInternals::TargetPropertyEntry*>::iterator position
= before ? this->Internal->IncludeDirectoriesEntries.begin()
: this->Internal->IncludeDirectoriesEntries.end();
this->Internal->IncludeDirectoriesEntries.insert(position,
new cmTargetInternals::TargetPropertyEntry(ge.Parse(entry.Value)));
new cmTargetInternals::TargetPropertyEntry(ge.Parse(entry)));
}
//----------------------------------------------------------------------------

View File

@ -572,7 +572,8 @@ public:
std::vector<std::string> GetIncludeDirectories(
const std::string& config,
const std::string& language) const;
void InsertInclude(const cmValueWithOrigin &entry,
void InsertInclude(std::string const& entry,
cmListFileBacktrace const& bt,
bool before = false);
void InsertCompileOption(std::string const& entry,
cmListFileBacktrace const& bt,

View File

@ -72,8 +72,7 @@ bool cmTargetIncludeDirectoriesCommand
bool prepend, bool system)
{
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
cmValueWithOrigin entry(this->Join(content), lfbt);
tgt->InsertInclude(entry, prepend);
tgt->InsertInclude(this->Join(content), lfbt, prepend);
if (system)
{
tgt->AddSystemIncludeDirectories(content);