Use cpp.systemIncludePaths for Qt headers, so that building Qt applications no longer triggers warnings from Qt headers unrelated to the user code.

This feature available since Qbs 1.22.
This commit is contained in:
Roman Telezhynskyi 2023-01-17 16:13:11 +03:00
parent f4fb0b4a24
commit 09747beea9

View File

@ -782,6 +782,44 @@ Module {
return flags; return flags;
} }
Properties {
condition: Utilities.versionCompare(qbs.version, "1.22") < 0
cpp.systemIncludePaths: {
var qtLibs = [
"QtCore",
"QtSvg",
"QtXml",
"QtPrintSupport",
"QtXmlPatterns",
"QtWidgets",
"QtGui",
"QtNetwork",
"QtTest",
"QtConcurrent"
];
var paths = [];
if (!qbs.targetOS.contains("macos"))
{
paths.push(Qt.core.incPath);
for (var i = 0; i < qtLibs.length; i++) {
paths.push(FileInfo.joinPaths(Qt.core.incPath, qtLibs[i]));
}
} else {
for (var i = 0; i < qtLibs.length; i++) {
paths.push(FileInfo.joinPaths(Qt.core.incPath, qtLibs[i] + ".framework/Versions/" + Qt.core.versionMajor +
"/Headers"));
paths.push(FileInfo.joinPaths(Qt.core.incPath, qtLibs[i] + ".framework/Headers"));
}
}
return paths;
}
}
Properties { Properties {
condition: qbs.toolchain.contains("gcc") condition: qbs.toolchain.contains("gcc")
cpp.driverFlags: { cpp.driverFlags: {