forked from qt-creator/qt-creator
CppTools: De-duplicate list of include paths
It makes more sense to handle this centrally than in all the build system plugins. Fixes: QTCREATORBUG-24515 Change-Id: I1c0f815d44135bcfb76ce51c67b6494a50e1de48 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -35,6 +35,8 @@
|
|||||||
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
|
#include <set>
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
namespace CppTools {
|
namespace CppTools {
|
||||||
@@ -94,7 +96,15 @@ static ProjectPart::Ptr projectPartFromRawProjectPart(
|
|||||||
part->projectMacros = rawProjectPart.projectMacros;
|
part->projectMacros = rawProjectPart.projectMacros;
|
||||||
if (!part->projectConfigFile.isEmpty())
|
if (!part->projectConfigFile.isEmpty())
|
||||||
part->projectMacros += Macro::toMacros(ProjectPart::readProjectConfigFile(part));
|
part->projectMacros += Macro::toMacros(ProjectPart::readProjectConfigFile(part));
|
||||||
part->headerPaths = rawProjectPart.headerPaths;
|
|
||||||
|
// Prevent duplicate include paths.
|
||||||
|
std::set<QString> seenPaths;
|
||||||
|
for (const HeaderPath &p : qAsConst(rawProjectPart.headerPaths)) {
|
||||||
|
const QString cleanPath = QDir::cleanPath(p.path);
|
||||||
|
if (seenPaths.insert(cleanPath).second)
|
||||||
|
part->headerPaths << HeaderPath(cleanPath, p.type);
|
||||||
|
}
|
||||||
|
|
||||||
part->precompiledHeaders = rawProjectPart.precompiledHeaders;
|
part->precompiledHeaders = rawProjectPart.precompiledHeaders;
|
||||||
part->selectedForBuilding = rawProjectPart.selectedForBuilding;
|
part->selectedForBuilding = rawProjectPart.selectedForBuilding;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user