forked from qt-creator/qt-creator
CppTools: Fix code model for Clang builds
If you build Qt Creator with CMake version 3.16, you will have precompile headers which will break code model. Change-Id: I679936faed39ecfedb9ebb5fb553449a9f5ea29d Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
@@ -329,9 +329,14 @@ void CompilerOptionsBuilder::addPrecompiledHeaderOptions(UsePrecompiledHeaders u
|
||||
for (const QString &pchFile : m_projectPart.precompiledHeaders) {
|
||||
// Bail if build system precomiple header artifacts exists
|
||||
// Clang cannot handle foreign PCH files.
|
||||
if (QFile::exists(pchFile + ".gch") || QFile::exists(pchFile + ".pch"))
|
||||
if (QFile::exists(pchFile + ".gch") || QFile::exists(pchFile + ".pch")) {
|
||||
usePrecompiledHeaders = UsePrecompiledHeaders::No;
|
||||
|
||||
// In case of Clang compilers, remove the pch-inclusion arguments
|
||||
remove({"-Xclang", "-include-pch", "-Xclang", pchFile + ".gch"});
|
||||
remove({"-Xclang", "-include-pch", "-Xclang", pchFile + ".pch"});
|
||||
}
|
||||
|
||||
if (usePrecompiledHeaders == UsePrecompiledHeaders::No) {
|
||||
// CMake PCH will already have force included the header file in
|
||||
// command line options, remove it if exists.
|
||||
|
Reference in New Issue
Block a user