Merge pull request #917 from x29a/unique_includes

Unique includes
This commit is contained in:
Daniel Marjamäki 2017-06-23 20:21:38 +02:00 committed by GitHub
commit dc37034687
1 changed files with 6 additions and 1 deletions

View File

@ -122,7 +122,12 @@ static bool simplifyPathWithVariables(std::string &s, const std::map<std::string
void ImportProject::FileSettings::setIncludePaths(const std::string &basepath, const std::list<std::string> &in, const std::map<std::string, std::string> &variables) void ImportProject::FileSettings::setIncludePaths(const std::string &basepath, const std::list<std::string> &in, const std::map<std::string, std::string> &variables)
{ {
std::list<std::string> I; std::list<std::string> I;
for (std::list<std::string>::const_iterator it = in.begin(); it != in.end(); ++it) { // only parse each includePath once - so remove duplicates
std::list<std::string> uniqueIncludePaths = in;
uniqueIncludePaths.sort();
uniqueIncludePaths.unique();
for (std::list<std::string>::const_iterator it = uniqueIncludePaths.begin(); it != uniqueIncludePaths.end(); ++it) {
if (it->empty()) if (it->empty())
continue; continue;
if (it->compare(0,2,"%(")==0) if (it->compare(0,2,"%(")==0)