forked from qt-creator/qt-creator
CompilationDBProjectManager: Handle relative sysroot
Fixes: QTCREATORBUG-22388 Change-Id: I030b105897bd483c17aaf86229d4515b2dd747d3 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
@@ -186,7 +186,7 @@ void filteredFlags(const QString &fileName,
|
|||||||
|
|
||||||
if (flag.startsWith("--sysroot=")) {
|
if (flag.startsWith("--sysroot=")) {
|
||||||
if (sysRoot.isEmpty())
|
if (sysRoot.isEmpty())
|
||||||
sysRoot = flag.mid(10);
|
sysRoot = updatedPathFlag(flag.mid(10), workingDir);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -97,7 +97,8 @@ TEST_F(CompilationDatabaseUtils, FilterArguments)
|
|||||||
QString::fromUtf8(HostOsInfo::isWindowsHost() ? winPath2 : otherPath2),
|
QString::fromUtf8(HostOsInfo::isWindowsHost() ? winPath2 : otherPath2),
|
||||||
"-x",
|
"-x",
|
||||||
"c++",
|
"c++",
|
||||||
"--sysroot=C:\\sysroot\\embedded",
|
QString("--sysroot=") + (HostOsInfo::isWindowsHost()
|
||||||
|
? "C:\\sysroot\\embedded" : "/opt/sysroot/embedded"),
|
||||||
"C:\\qt-creator\\src\\plugins\\cpptools\\compileroptionsbuilder.cpp"},
|
"C:\\qt-creator\\src\\plugins\\cpptools\\compileroptionsbuilder.cpp"},
|
||||||
"compileroptionsbuilder");
|
"compileroptionsbuilder");
|
||||||
|
|
||||||
@@ -120,7 +121,8 @@ TEST_F(CompilationDatabaseUtils, FilterArguments)
|
|||||||
{"RELATIVE_PLUGIN_PATH", "\"../lib/qtcreator/plugins\""},
|
{"RELATIVE_PLUGIN_PATH", "\"../lib/qtcreator/plugins\""},
|
||||||
{"QT_CREATOR", "1"}}));
|
{"QT_CREATOR", "1"}}));
|
||||||
ASSERT_THAT(fileKind, CppTools::ProjectFile::Kind::CXXSource);
|
ASSERT_THAT(fileKind, CppTools::ProjectFile::Kind::CXXSource);
|
||||||
ASSERT_THAT(sysRoot, QString("C:\\sysroot\\embedded"));
|
ASSERT_THAT(sysRoot, HostOsInfo::isWindowsHost() ? QString("C:\\sysroot\\embedded")
|
||||||
|
: QString("/opt/sysroot/embedded"));
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString kCmakeCommand
|
static QString kCmakeCommand
|
||||||
|
Reference in New Issue
Block a user