From c21db870a5912015a3fe64753a7df49318ceff1e Mon Sep 17 00:00:00 2001 From: David Cole Date: Wed, 22 Feb 2012 07:23:06 -0500 Subject: Make search paths ordered and unique Avoid duplicates. Same as before the introduction of the INCLUDE_DIRECTORIES target property. --- Source/cmMakeDepend.cxx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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 uniqueIncludes; + std::vector 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::const_iterator + it = orderedAndUniqueIncludes.begin(); + it != orderedAndUniqueIncludes.end(); + ++it) + { + this->AddSearchPath(it->c_str()); + } } -- cgit v0.12