summaryrefslogtreecommitdiffstats
path: root/Source/cmMakeDepend.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmMakeDepend.cxx')
-rw-r--r--Source/cmMakeDepend.cxx35
1 files changed, 26 insertions, 9 deletions
diff --git a/Source/cmMakeDepend.cxx b/Source/cmMakeDepend.cxx
index 0b4eea5..6055c55 100644
--- a/Source/cmMakeDepend.cxx
+++ b/Source/cmMakeDepend.cxx
@@ -54,16 +54,33 @@ void cmMakeDepend::SetMakefile(cmMakefile* makefile)
this->Makefile->IncludeFileRegularExpression.c_str());
this->ComplainFileRegularExpression.compile(
this->Makefile->ComplainFileRegularExpression.c_str());
-
- // Now extract any include paths from the makefile flags
- const std::vector<std::string>& includes =
- this->Makefile->GetIncludeDirectories();
- for(std::vector<std::string>::const_iterator j = includes.begin();
- j != includes.end(); ++j)
+
+ // 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)
+ {
+ const std::vector<std::string>& includes =
+ l->second.GetIncludeDirectories();
+ for(std::vector<std::string>::const_iterator j = includes.begin();
+ j != includes.end(); ++j)
+ {
+ std::string path = *j;
+ this->Makefile->ExpandVariablesInString(path);
+ if(uniqueIncludes.insert(path).second)
+ {
+ orderedAndUniqueIncludes.push_back(path);
+ }
+ }
+ }
+
+ for(std::vector<std::string>::const_iterator
+ it = orderedAndUniqueIncludes.begin();
+ it != orderedAndUniqueIncludes.end();
+ ++it)
{
- std::string path = *j;
- this->Makefile->ExpandVariablesInString(path);
- this->AddSearchPath(path.c_str());
+ this->AddSearchPath(it->c_str());
}
}