summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@qt.io>2016-05-13 13:34:18 +0200
committerTobias Hunger <tobias.hunger@qt.io>2016-05-23 13:03:20 +0000
commit5d69bdfde72d39acb1ad0ee4092d0d8fe7461d8e (patch)
tree401a3e3d698ed39ccac765f4022b385a62139bf1 /src
parent6456cc35b048ca90bfdb235384485c920312f136 (diff)
downloadqt-creator-5d69bdfde72d39acb1ad0ee4092d0d8fe7461d8e.tar.gz
CMake: Cache CMakeCache.txt
Change-Id: Ib3e7a9943d15a2e90afd29642b666892ba7b0613 Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/cmakeprojectmanager/builddirmanager.cpp29
-rw-r--r--src/plugins/cmakeprojectmanager/builddirmanager.h1
2 files changed, 15 insertions, 15 deletions
diff --git a/src/plugins/cmakeprojectmanager/builddirmanager.cpp b/src/plugins/cmakeprojectmanager/builddirmanager.cpp
index a15e220459..cec3fce743 100644
--- a/src/plugins/cmakeprojectmanager/builddirmanager.cpp
+++ b/src/plugins/cmakeprojectmanager/builddirmanager.cpp
@@ -172,6 +172,7 @@ void BuildDirManager::resetData()
{
m_hasData = false;
+ m_cmakeCache.clear();
m_projectName.clear();
m_buildTargets.clear();
m_watchedFiles.clear();
@@ -271,21 +272,19 @@ void BuildDirManager::clearFiles()
CMakeConfig BuildDirManager::parsedConfiguration() const
{
- if (!m_hasData)
- return CMakeConfig();
-
- Utils::FileName cacheFile = workDirectory();
- cacheFile.appendPath(QLatin1String("CMakeCache.txt"));
- QString errorMessage;
- CMakeConfig result = parseConfiguration(cacheFile, &errorMessage);
- if (!errorMessage.isEmpty())
- emit errorOccured(errorMessage);
- const Utils::FileName sourceOfBuildDir
- = Utils::FileName::fromUtf8(CMakeConfigItem::valueOf("CMAKE_HOME_DIRECTORY", result));
- if (sourceOfBuildDir != sourceDirectory()) // Use case-insensitive compare where appropriate
- emit errorOccured(tr("The build directory is not for %1").arg(sourceDirectory().toUserOutput()));
-
- return result;
+ if (m_cmakeCache.isEmpty()) {
+ Utils::FileName cacheFile = workDirectory();
+ cacheFile.appendPath(QLatin1String("CMakeCache.txt"));
+ QString errorMessage;
+ m_cmakeCache = parseConfiguration(cacheFile, &errorMessage);
+ if (!errorMessage.isEmpty())
+ emit errorOccured(errorMessage);
+ const Utils::FileName sourceOfBuildDir
+ = Utils::FileName::fromUtf8(CMakeConfigItem::valueOf("CMAKE_HOME_DIRECTORY", m_cmakeCache));
+ if (sourceOfBuildDir != sourceDirectory()) // Use case-insensitive compare where appropriate
+ emit errorOccured(tr("The build directory is not for %1").arg(sourceDirectory().toUserOutput()));
+ }
+ return m_cmakeCache;
}
void BuildDirManager::stopProcess()
diff --git a/src/plugins/cmakeprojectmanager/builddirmanager.h b/src/plugins/cmakeprojectmanager/builddirmanager.h
index 686face66b..f88b21580d 100644
--- a/src/plugins/cmakeprojectmanager/builddirmanager.h
+++ b/src/plugins/cmakeprojectmanager/builddirmanager.h
@@ -112,6 +112,7 @@ private:
const CMakeBuildConfiguration *m_buildConfiguration = nullptr;
Utils::QtcProcess *m_cmakeProcess = nullptr;
QTemporaryDir *m_tempDir = nullptr;
+ mutable CMakeConfig m_cmakeCache;
QSet<Utils::FileName> m_watchedFiles;
QString m_projectName;