summaryrefslogtreecommitdiffstats
path: root/Source/cmMakeDepend.cxx
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2012-02-22 12:23:06 (GMT)
committerDavid Cole <david.cole@kitware.com>2012-02-22 12:29:32 (GMT)
commitc21db870a5912015a3fe64753a7df49318ceff1e (patch)
tree6a85dfd552eb0c0551c84edcdf23688f137303de /Source/cmMakeDepend.cxx
parent22021f07f80163979e8dedfcefccee53f4693fae (diff)
downloadCMake-c21db870a5912015a3fe64753a7df49318ceff1e.zip
CMake-c21db870a5912015a3fe64753a7df49318ceff1e.tar.gz
CMake-c21db870a5912015a3fe64753a7df49318ceff1e.tar.bz2
Make search paths ordered and unique
Avoid duplicates. Same as before the introduction of the INCLUDE_DIRECTORIES target property.
Diffstat (limited to 'Source/cmMakeDepend.cxx')
-rw-r--r--Source/cmMakeDepend.cxx15
1 files changed, 14 insertions, 1 deletions
diff --git a/Source/cmMakeDepend.cxx b/Source/cmMakeDepend.cxx
index 03fe33d..6055c55 100644
--- a/Source/cmMakeDepend.cxx
+++ b/Source/cmMakeDepend.cxx
@@ -56,6 +56,8 @@ void cmMakeDepend::SetMakefile(cmMakefile* makefile)
this->Makefile->ComplainFileRegularExpression.c_str());
// Now extract any include paths from the targets
+ std::set<std::string> uniqueIncludes;
+ std::vector<std::string> orderedAndUniqueIncludes;
cmTargets & targets = this->Makefile->GetTargets();
for (cmTargets::iterator l = targets.begin(); l != targets.end(); ++l)
{
@@ -66,9 +68,20 @@ void cmMakeDepend::SetMakefile(cmMakefile* makefile)
{
std::string path = *j;
this->Makefile->ExpandVariablesInString(path);
- this->AddSearchPath(path.c_str());
+ if(uniqueIncludes.insert(path).second)
+ {
+ orderedAndUniqueIncludes.push_back(path);
+ }
}
}
+
+ for(std::vector<std::string>::const_iterator
+ it = orderedAndUniqueIncludes.begin();
+ it != orderedAndUniqueIncludes.end();
+ ++it)
+ {
+ this->AddSearchPath(it->c_str());
+ }
}