diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 8276faa7d..58d9d7301 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -273,21 +273,18 @@ void cmMakefile::IssueMessage(cmake::MessageType t, } } -std::vector cmMakefile::GetIncludeDirectoriesEntries() const +std::vector cmMakefile::GetIncludeDirectoriesEntries() const { - std::vector entries; - entries.reserve(this->IncludeDirectoriesEntries.size()); - std::vector::const_iterator btIt = - this->IncludeDirectoriesEntryBacktraces.begin(); - for(std::vector::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 +cmMakefile::GetIncludeDirectoriesBacktraces() const +{ + return this->IncludeDirectoriesEntryBacktraces; +} + + std::vector cmMakefile::GetCompileOptionsEntries() const { return this->CompileOptionsEntries; @@ -1942,7 +1939,6 @@ void cmMakefile::AddIncludeDirectories(const std::vector &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 &incs, l != this->Targets.end(); ++l) { cmTarget &t = l->second; - t.InsertInclude(entry, before); + t.InsertInclude(entryString, lfbt, before); } } diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 9b216087d..8f236af6c 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -746,7 +746,8 @@ public: /** Set whether or not to report a CMP0000 violation. */ void SetCheckCMP0000(bool b) { this->CheckCMP0000 = b; } - std::vector GetIncludeDirectoriesEntries() const; + std::vector GetIncludeDirectoriesEntries() const; + std::vector GetIncludeDirectoriesBacktraces() const; std::vector GetCompileOptionsEntries() const; std::vector GetCompileOptionsBacktraces() const; std::vector GetCompileDefinitionsEntries() const; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 0aa66cd8b..ac453e2d5 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -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 parentIncludes = - this->Makefile->GetIncludeDirectoriesEntries(); + const std::vector parentIncludes = + this->Makefile->GetIncludeDirectoriesEntries(); + const std::vector parentIncludesBts = + this->Makefile->GetIncludeDirectoriesBacktraces(); - for (std::vector::const_iterator it - = parentIncludes.begin(); it != parentIncludes.end(); ++it) + std::vector::const_iterator btIt = + parentIncludesBts.begin(); + for (std::vector::const_iterator it + = parentIncludes.begin(); + it != parentIncludes.end(); ++it, ++btIt) { - this->InsertInclude(*it); + this->InsertInclude(*it, *btIt); } const std::set parentSystemIncludes = this->Makefile->GetSystemIncludeDirectories(); @@ -421,8 +426,7 @@ void cmTarget::SetMakefile(cmMakefile* mf) const std::vector parentOptionsBts = this->Makefile->GetCompileOptionsBacktraces(); - std::vector::const_iterator btIt = - parentOptionsBts.begin(); + btIt = parentOptionsBts.begin(); for (std::vector::const_iterator it = parentOptions.begin(); it != parentOptions.end(); ++it, ++btIt) @@ -1931,17 +1935,18 @@ void cmTarget::AppendBuildInterfaceIncludes() } //---------------------------------------------------------------------------- -void cmTarget::InsertInclude(const cmValueWithOrigin &entry, - bool before) +void cmTarget::InsertInclude(std::string const& entry, + cmListFileBacktrace const& bt, + bool before) { - cmGeneratorExpression ge(entry.Backtrace); + cmGeneratorExpression ge(bt); std::vector::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))); } //---------------------------------------------------------------------------- diff --git a/Source/cmTarget.h b/Source/cmTarget.h index ba3bc5a7a..f9bcb0576 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -572,7 +572,8 @@ public: std::vector 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, diff --git a/Source/cmTargetIncludeDirectoriesCommand.cxx b/Source/cmTargetIncludeDirectoriesCommand.cxx index 24500db13..7824c898d 100644 --- a/Source/cmTargetIncludeDirectoriesCommand.cxx +++ b/Source/cmTargetIncludeDirectoriesCommand.cxx @@ -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);