CMake: Reimplement CMakeCache.txt parsing in BuildDirManager

The CMakeProjectImporter will need that in addition to the tealeafreader.

Change-Id: I453a7a124b5303e163e9c85bc3fc215215617119
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Tobias Hunger
2017-02-07 17:23:30 +01:00
parent 87504eac2d
commit c09b3709b9
3 changed files with 24 additions and 8 deletions

View File

@@ -337,6 +337,19 @@ CMakeConfig BuildDirManager::parsedConfiguration() const
return m_cmakeCache;
}
CMakeConfig BuildDirManager::parseConfiguration(const Utils::FileName &cacheFile, QString *errorMessage)
{
if (!cacheFile.exists()) {
if (errorMessage)
*errorMessage = tr("CMakeCache.txt file not found.");
return { };
}
CMakeConfig result = CMakeConfigItem::itemsFromFile(cacheFile, errorMessage);
if (!errorMessage->isEmpty())
return { };
return result;
}
void BuildDirManager::checkConfiguration()
{
if (m_tempDir) // always throw away changes in the tmpdir!