aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cpptools/headerpathfilter.cpp
diff options
context:
space:
mode:
authorMarco Bubke <marco.bubke@qt.io>2019-04-07 20:46:06 +0200
committerMarco Bubke <marco.bubke@qt.io>2019-04-23 09:08:33 +0000
commit5ab057746c662aba3308eff99e48c1e6bcc2b51e (patch)
treebd2d55c3edb3fc67a26a9bc94ecb7f02d45c3d40 /src/plugins/cpptools/headerpathfilter.cpp
parent3bd653416a70f1b7cb68f248b915ab6b5f7d96ea (diff)
CppTools: Add pre system include search path per project
Sometimes you want add a pre system include search path per project to overload some system header for indexing. This can then even be checked in the repository. Change-Id: Ib103e5935d0553aa94522ed736f8c4eb2405a093 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Diffstat (limited to 'src/plugins/cpptools/headerpathfilter.cpp')
-rw-r--r--src/plugins/cpptools/headerpathfilter.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/plugins/cpptools/headerpathfilter.cpp b/src/plugins/cpptools/headerpathfilter.cpp
index b514c468d76..98c4579cbae 100644
--- a/src/plugins/cpptools/headerpathfilter.cpp
+++ b/src/plugins/cpptools/headerpathfilter.cpp
@@ -29,6 +29,8 @@
#include <coreplugin/icore.h>
#endif
+#include <projectexplorer/project.h>
+
#include <QRegularExpression>
namespace CppTools {
@@ -41,6 +43,8 @@ void HeaderPathFilter::process()
{
const HeaderPaths &headerPaths = projectPart.headerPaths;
+ addPreIncludesPath();
+
for (const HeaderPath &headerPath : headerPaths)
filterHeaderPath(headerPath);
@@ -141,6 +145,18 @@ void HeaderPathFilter::tweakHeaderPaths()
}
}
+void HeaderPathFilter::addPreIncludesPath()
+{
+ if (projectDirectory.size()) {
+ Utils::FileName rootProjectDirectory = Utils::FileName::fromString(projectDirectory);
+
+ rootProjectDirectory.appendPath(".pre_includes");
+
+ systemHeaderPaths.push_back(
+ {rootProjectDirectory.toString(), ProjectExplorer::HeaderPathType::System});
+ }
+}
+
QString HeaderPathFilter::ensurePathWithSlashEnding(const QString &path)
{
QString pathWithSlashEnding = path;