forked from qt-creator/qt-creator
CMake: Cache CMakeCache.txt
Change-Id: Ib3e7a9943d15a2e90afd29642b666892ba7b0613 Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
This commit is contained in:
@@ -172,6 +172,7 @@ void BuildDirManager::resetData()
|
|||||||
{
|
{
|
||||||
m_hasData = false;
|
m_hasData = false;
|
||||||
|
|
||||||
|
m_cmakeCache.clear();
|
||||||
m_projectName.clear();
|
m_projectName.clear();
|
||||||
m_buildTargets.clear();
|
m_buildTargets.clear();
|
||||||
m_watchedFiles.clear();
|
m_watchedFiles.clear();
|
||||||
@@ -271,21 +272,19 @@ void BuildDirManager::clearFiles()
|
|||||||
|
|
||||||
CMakeConfig BuildDirManager::parsedConfiguration() const
|
CMakeConfig BuildDirManager::parsedConfiguration() const
|
||||||
{
|
{
|
||||||
if (!m_hasData)
|
if (m_cmakeCache.isEmpty()) {
|
||||||
return CMakeConfig();
|
|
||||||
|
|
||||||
Utils::FileName cacheFile = workDirectory();
|
Utils::FileName cacheFile = workDirectory();
|
||||||
cacheFile.appendPath(QLatin1String("CMakeCache.txt"));
|
cacheFile.appendPath(QLatin1String("CMakeCache.txt"));
|
||||||
QString errorMessage;
|
QString errorMessage;
|
||||||
CMakeConfig result = parseConfiguration(cacheFile, &errorMessage);
|
m_cmakeCache = parseConfiguration(cacheFile, &errorMessage);
|
||||||
if (!errorMessage.isEmpty())
|
if (!errorMessage.isEmpty())
|
||||||
emit errorOccured(errorMessage);
|
emit errorOccured(errorMessage);
|
||||||
const Utils::FileName sourceOfBuildDir
|
const Utils::FileName sourceOfBuildDir
|
||||||
= Utils::FileName::fromUtf8(CMakeConfigItem::valueOf("CMAKE_HOME_DIRECTORY", result));
|
= Utils::FileName::fromUtf8(CMakeConfigItem::valueOf("CMAKE_HOME_DIRECTORY", m_cmakeCache));
|
||||||
if (sourceOfBuildDir != sourceDirectory()) // Use case-insensitive compare where appropriate
|
if (sourceOfBuildDir != sourceDirectory()) // Use case-insensitive compare where appropriate
|
||||||
emit errorOccured(tr("The build directory is not for %1").arg(sourceDirectory().toUserOutput()));
|
emit errorOccured(tr("The build directory is not for %1").arg(sourceDirectory().toUserOutput()));
|
||||||
|
}
|
||||||
return result;
|
return m_cmakeCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BuildDirManager::stopProcess()
|
void BuildDirManager::stopProcess()
|
||||||
|
|||||||
@@ -112,6 +112,7 @@ private:
|
|||||||
const CMakeBuildConfiguration *m_buildConfiguration = nullptr;
|
const CMakeBuildConfiguration *m_buildConfiguration = nullptr;
|
||||||
Utils::QtcProcess *m_cmakeProcess = nullptr;
|
Utils::QtcProcess *m_cmakeProcess = nullptr;
|
||||||
QTemporaryDir *m_tempDir = nullptr;
|
QTemporaryDir *m_tempDir = nullptr;
|
||||||
|
mutable CMakeConfig m_cmakeCache;
|
||||||
|
|
||||||
QSet<Utils::FileName> m_watchedFiles;
|
QSet<Utils::FileName> m_watchedFiles;
|
||||||
QString m_projectName;
|
QString m_projectName;
|
||||||
|
|||||||
Reference in New Issue
Block a user