forked from qt-creator/qt-creator
Qbs: Fix pch detection when there are multiple tags
Change-Id: I21f789cbaa01b36180b3566420a01e5b052d6ace Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
5bf9ac7d56
commit
218a439bd5
@@ -72,6 +72,7 @@
|
|||||||
#include <QElapsedTimer>
|
#include <QElapsedTimer>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QSet>
|
||||||
#include <QVariantMap>
|
#include <QVariantMap>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@@ -936,13 +937,14 @@ void QbsProject::updateCppCodeModel()
|
|||||||
QString objcPch;
|
QString objcPch;
|
||||||
QString objcxxPch;
|
QString objcxxPch;
|
||||||
const auto &pchFinder = [&cPch, &cxxPch, &objcPch, &objcxxPch](const qbs::ArtifactData &a) {
|
const auto &pchFinder = [&cPch, &cxxPch, &objcPch, &objcxxPch](const qbs::ArtifactData &a) {
|
||||||
if (a.fileTags().contains("c_pch_src"))
|
const QStringList fileTags = a.fileTags();
|
||||||
|
if (fileTags.contains("c_pch_src"))
|
||||||
cPch = a.filePath();
|
cPch = a.filePath();
|
||||||
else if (a.fileTags().contains("cpp_pch_src"))
|
if (fileTags.contains("cpp_pch_src"))
|
||||||
cxxPch = a.filePath();
|
cxxPch = a.filePath();
|
||||||
else if (a.fileTags().contains("objc_pch_src"))
|
if (fileTags.contains("objc_pch_src"))
|
||||||
objcPch = a.filePath();
|
objcPch = a.filePath();
|
||||||
else if (a.fileTags().contains("objcpp_pch_src"))
|
if (fileTags.contains("objcpp_pch_src"))
|
||||||
objcxxPch = a.filePath();
|
objcxxPch = a.filePath();
|
||||||
};
|
};
|
||||||
const QList<qbs::ArtifactData> &generatedArtifacts = prd.generatedArtifacts();
|
const QList<qbs::ArtifactData> &generatedArtifacts = prd.generatedArtifacts();
|
||||||
@@ -1038,7 +1040,7 @@ void QbsProject::updateCppCodeModel()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList pchFiles;
|
QSet<QString> pchFiles;
|
||||||
if (hasCFiles && props.getModuleProperty("cpp", "useCPrecompiledHeader").toBool()
|
if (hasCFiles && props.getModuleProperty("cpp", "useCPrecompiledHeader").toBool()
|
||||||
&& !cPch.isEmpty()) {
|
&& !cPch.isEmpty()) {
|
||||||
pchFiles << cPch;
|
pchFiles << cPch;
|
||||||
@@ -1061,7 +1063,7 @@ void QbsProject::updateCppCodeModel()
|
|||||||
<< grp.name() << "in product" << prd.name();
|
<< grp.name() << "in product" << prd.name();
|
||||||
qCWarning(qbsPmLog) << "Expect problems with code model";
|
qCWarning(qbsPmLog) << "Expect problems with code model";
|
||||||
}
|
}
|
||||||
rpp.setPreCompiledHeaders(pchFiles);
|
rpp.setPreCompiledHeaders(pchFiles.toList());
|
||||||
rpp.setFiles(grp.allFilePaths(), [filePathToSourceArtifact](const QString &filePath) {
|
rpp.setFiles(grp.allFilePaths(), [filePathToSourceArtifact](const QString &filePath) {
|
||||||
// Keep this lambda thread-safe!
|
// Keep this lambda thread-safe!
|
||||||
return cppFileType(filePathToSourceArtifact.value(filePath));
|
return cppFileType(filePathToSourceArtifact.value(filePath));
|
||||||
|
|||||||
Reference in New Issue
Block a user