forked from qt-creator/qt-creator
CMake: Fall back to reading CMakeCache.txt
Allows the user to select cache settings even if configuring failed. Change-Id: I821c28f386e0c249b4c4d9c6561a377cb48b3f2d Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -838,6 +838,7 @@ static QStringList uniqueTargetFiles(const Configuration &config)
|
||||
|
||||
FileApiData FileApiParser::parseData(QPromise<std::shared_ptr<FileApiQtcData>> &promise,
|
||||
const FilePath &replyFilePath,
|
||||
const Utils::FilePath &buildDir,
|
||||
const QString &cmakeBuildType,
|
||||
QString &errorMessage)
|
||||
{
|
||||
@@ -857,7 +858,11 @@ FileApiData FileApiParser::parseData(QPromise<std::shared_ptr<FileApiQtcData>> &
|
||||
result.replyFile = readReplyFile(replyFilePath, errorMessage);
|
||||
if (cancelCheck())
|
||||
return {};
|
||||
result.cache = readCacheFile(result.replyFile.jsonFile("cache", replyDir), errorMessage);
|
||||
const FilePath cachePathFromReply = result.replyFile.jsonFile("cache", replyDir);
|
||||
if (cachePathFromReply.isEmpty())
|
||||
result.cache = CMakeConfig::fromFile(buildDir / "CMakeCache.txt", &errorMessage);
|
||||
else
|
||||
result.cache = readCacheFile(cachePathFromReply, errorMessage);
|
||||
if (cancelCheck())
|
||||
return {};
|
||||
result.cmakeFiles = readCMakeFilesFile(result.replyFile.jsonFile("cmakeFiles", replyDir),
|
||||
|
||||
@@ -223,6 +223,7 @@ class FileApiParser
|
||||
public:
|
||||
static FileApiData parseData(QPromise<std::shared_ptr<FileApiQtcData>> &promise,
|
||||
const Utils::FilePath &replyFilePath,
|
||||
const Utils::FilePath &buildDir,
|
||||
const QString &cmakeBuildType,
|
||||
QString &errorMessage);
|
||||
|
||||
|
||||
@@ -263,6 +263,7 @@ void FileApiReader::endState(const FilePath &replyFilePath, bool restoredFromBac
|
||||
auto result = std::make_shared<FileApiQtcData>();
|
||||
FileApiData data = FileApiParser::parseData(promise,
|
||||
replyFilePath,
|
||||
buildDirectory,
|
||||
cmakeBuildType,
|
||||
result->errorMessage);
|
||||
if (result->errorMessage.isEmpty()) {
|
||||
@@ -270,6 +271,7 @@ void FileApiReader::endState(const FilePath &replyFilePath, bool restoredFromBac
|
||||
sourceDirectory, buildDirectory);
|
||||
} else {
|
||||
qWarning() << result->errorMessage;
|
||||
result->cache = std::move(data.cache);
|
||||
}
|
||||
|
||||
promise.addResult(result);
|
||||
|
||||
Reference in New Issue
Block a user