diff options
Diffstat (limited to 'src/plugins/cpptools/compileroptionsbuilder.cpp')
-rw-r--r-- | src/plugins/cpptools/compileroptionsbuilder.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/plugins/cpptools/compileroptionsbuilder.cpp b/src/plugins/cpptools/compileroptionsbuilder.cpp index aafcd35b37..ee534757ea 100644 --- a/src/plugins/cpptools/compileroptionsbuilder.cpp +++ b/src/plugins/cpptools/compileroptionsbuilder.cpp @@ -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. |