CMakeBuildSystem: Don't re-update code model on CMakeLists.txt saves

Currently if you edit a CMakeLists.txt and then press save, the code
model will be reindexed.

On projects like Qt Creator this operation is quite significant.

Note that the code model is updated after CMake has run on the project,
which is what I would expect.

Saving the CMakeLists.txt and not running CMake has no effect on the
project, and the code model shoudn't be reindexed.

Change-Id: I61289fda60752ef002cf3625d339d4fcaf144d1b
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Cristian Adam
2020-02-20 11:20:32 +01:00
committed by Tobias Hunger
parent 65e244b238
commit f65f260c91
3 changed files with 11 additions and 25 deletions

View File

@@ -26,6 +26,7 @@
#include "cmakebuildsystem.h"
#include "cmakebuildconfiguration.h"
#include "cmakekitinformation.h"
#include "cmakeproject.h"
#include "cmakeprojectconstants.h"
#include "cmakeprojectnodes.h"
@@ -204,10 +205,13 @@ CMakeBuildSystem::CMakeBuildSystem(CMakeBuildConfiguration *bc)
connect(project(), &Project::projectFileIsDirty, this, [this]() {
if (m_buildConfiguration->isActive()) {
qCDebug(cmakeBuildSystemLog) << "Requesting parse due to dirty project file";
m_buildDirManager
.setParametersAndRequestParse(BuildDirParameters(m_buildConfiguration),
BuildDirManager::REPARSE_DEFAULT);
const auto cmake = CMakeKitAspect::cmakeTool(m_buildConfiguration->target()->kit());
if (cmake && cmake->isAutoRun()) {
qCDebug(cmakeBuildSystemLog) << "Requesting parse due to dirty project file";
m_buildDirManager.setParametersAndRequestParse(BuildDirParameters(
m_buildConfiguration),
BuildDirManager::REPARSE_DEFAULT);
}
}
});