forked from qt-creator/qt-creator
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user