CMakeProjectManager: Fix issues with precompiled headers

Clang code model can break if CMake project uses precompiled headers.

QtCreator will make a copy of the precompiled header, this way it
will not conflict with the build system one.

Ammends 888ea6bbbb

Fixes: QTCREATORBUG-24945
Fixes: QTCREATORBUG-25213
Change-Id: I149fc416cd047683d095758a024de47c7baf681c
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Cristian Adam
2021-01-11 15:57:16 +01:00
parent a64defa10b
commit 98b92ed03e
5 changed files with 81 additions and 47 deletions

View File

@@ -219,6 +219,29 @@ bool FileUtils::copyRecursively(const FilePath &srcFilePath, const FilePath &tgt
});
}
/*!
Copies a file specified by \a srcFilePath to \a tgtFilePath only if \a srcFilePath is different
(file size and last modification time).
Returns whether the operation succeeded.
*/
bool FileUtils::copyIfDifferent(const FilePath &srcFilePath, const FilePath &tgtFilePath)
{
if (QFile::exists(tgtFilePath.toString())) {
const QFileInfo srcFileInfo = srcFilePath.toFileInfo();
const QFileInfo tgtFileInfo = tgtFilePath.toFileInfo();
if (srcFileInfo.lastModified() == tgtFileInfo.lastModified() &&
srcFileInfo.size() == tgtFileInfo.size()) {
return true;
} else {
QFile::remove(tgtFilePath.toString());
}
}
return QFile::copy(srcFilePath.toString(), tgtFilePath.toString());
}
/*!
If this is a directory, the function will recursively check all files and return
true if one of them is newer than \a timeStamp. If this is a single file, true will