Make search paths ordered and unique

Avoid duplicates. Same as before the introduction of the INCLUDE_DIRECTORIES
target property.
This commit is contained in:
David Cole 2012-02-22 07:23:06 -05:00
parent 22021f07f8
commit c21db870a5
1 changed files with 14 additions and 1 deletions

View File

@ -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());
}
}