forked from qt-creator/qt-creator
ProjectExplorer: Use FilePath for sysroots
... and reduce to the relevant part when passing to cmake. Task-number: QTCREATORBUG-27229 Change-Id: I7cde2ff04530caf439d6707c2c6d15a8e734ae0b Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -45,6 +45,7 @@
|
||||
|
||||
using namespace CppEditor;
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Utils;
|
||||
|
||||
namespace CompilationDatabaseProjectManager {
|
||||
namespace Internal {
|
||||
@@ -124,7 +125,7 @@ public:
|
||||
QStringList flags;
|
||||
QString fileName;
|
||||
QString workingDir;
|
||||
QString sysRoot;
|
||||
FilePath sysRoot;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -183,8 +184,8 @@ void CompilationDatabaseTests::testFilterArguments()
|
||||
{"RELATIVE_PLUGIN_PATH", "\"../lib/qtcreator/plugins\""},
|
||||
{"QT_CREATOR", "1"}}));
|
||||
QCOMPARE(testData.fileKind, CppEditor::ProjectFile::Kind::CXXSource);
|
||||
QCOMPARE(testData.sysRoot, HostOsInfo::isWindowsHost() ? QString("C:\\sysroot\\embedded")
|
||||
: QString("/opt/sysroot/embedded"));
|
||||
QCOMPARE(testData.sysRoot.toString(), HostOsInfo::isWindowsHost() ? QString("C:\\sysroot\\embedded")
|
||||
: QString("/opt/sysroot/embedded"));
|
||||
}
|
||||
|
||||
static QString kCmakeCommand
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include <QSet>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Utils;
|
||||
|
||||
namespace CompilationDatabaseProjectManager {
|
||||
namespace Internal {
|
||||
@@ -102,7 +103,7 @@ void filteredFlags(const QString &fileName,
|
||||
HeaderPaths &headerPaths,
|
||||
Macros ¯os,
|
||||
CppEditor::ProjectFile::Kind &fileKind,
|
||||
QString &sysRoot)
|
||||
Utils::FilePath &sysRoot)
|
||||
{
|
||||
if (flags.empty())
|
||||
return;
|
||||
@@ -192,7 +193,7 @@ void filteredFlags(const QString &fileName,
|
||||
|
||||
if (flag.startsWith("--sysroot=")) {
|
||||
if (sysRoot.isEmpty())
|
||||
sysRoot = updatedPathFlag(flag.mid(10), workingDir);
|
||||
sysRoot = FilePath::fromString(updatedPathFlag(flag.mid(10), workingDir));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,10 +25,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "compilationdatabaseconstants.h"
|
||||
|
||||
#include <cppeditor/cppprojectfile.h>
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/filepath.h>
|
||||
|
||||
#include <QHash>
|
||||
#include <QStringList>
|
||||
@@ -65,7 +63,7 @@ void filteredFlags(const QString &fileName,
|
||||
QVector<ProjectExplorer::HeaderPath> &headerPaths,
|
||||
QVector<ProjectExplorer::Macro> ¯os,
|
||||
CppEditor::ProjectFile::Kind &fileKind,
|
||||
QString &sysRoot);
|
||||
Utils::FilePath &sysRoot);
|
||||
|
||||
QStringList splitCommandLine(QString commandLine, QSet<QString> &flagsCache);
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
|
||||
#include "compilationdbparser.h"
|
||||
|
||||
#include "compilationdatabaseconstants.h"
|
||||
|
||||
#include <coreplugin/progressmanager/progressmanager.h>
|
||||
#include <projectexplorer/task.h>
|
||||
#include <projectexplorer/treescanner.h>
|
||||
|
||||
Reference in New Issue
Block a user