Cmake: Replace connect/disconnect of builddirmanager

... by a permanent connection, and only evaluate output for the
active build configuration.

Task-number: QTCREATORBUG-21235
Change-Id: I06f87f7ea680f8f25687a0c5ffc936c801ab7de0
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
hjk
2019-09-13 14:01:58 +02:00
parent 8d3e4c03f0
commit 4a55d995e1
2 changed files with 14 additions and 19 deletions

View File

@@ -347,25 +347,12 @@ QVector<FilePath> BuildDirManager::takeProjectFilesToWatch()
Utils::FilePath sourceDir = m_parameters.sourceDirectory;
Utils::FilePath buildDir = m_parameters.workDirectory;
const QVector<FilePath> toWatch = Utils::filtered(m_reader->takeProjectFilesToWatch(),
return Utils::filtered(m_reader->takeProjectFilesToWatch(),
[&sourceDir,
&buildDir](const Utils::FilePath &p) {
return p.isChildOf(sourceDir)
|| p.isChildOf(buildDir);
});
if (!toWatch.isEmpty()) {
connect(project(), &Project::projectFileIsDirty, this, [this]() {
if (m_parameters.cmakeTool() && m_parameters.cmakeTool()->isAutoRun()) {
updateReparseParameters(REPARSE_DEFAULT);
emit requestReparse();
}
});
} else {
disconnect(project(), nullptr, this, nullptr);
}
return toWatch;
}
std::unique_ptr<CMakeProjectNode> BuildDirManager::generateProjectTree(

View File

@@ -170,6 +170,14 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(Target *parent, Core::Id id)
BuildDirManager::REPARSE_FORCE_CONFIGURATION);
}
});
connect(parent->project(), &Project::projectFileIsDirty, this, [this]() {
if (isActive()) {
m_buildDirManager
.setParametersAndRequestParse(BuildDirParameters(this),
BuildDirManager::REPARSE_DEFAULT);
}
});
}
void CMakeBuildConfiguration::initialize()