forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -53,6 +53,8 @@ private:
|
||||
|
||||
void tweakHeaderPaths();
|
||||
|
||||
void addPreIncludesPath();
|
||||
|
||||
bool isProjectHeaderPath(const QString &path) const;
|
||||
|
||||
static QString ensurePathWithSlashEnding(const QString &path);
|
||||
|
||||
Reference in New Issue
Block a user