forked from qt-creator/qt-creator
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:
@@ -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(),
|
||||
[&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;
|
||||
return Utils::filtered(m_reader->takeProjectFilesToWatch(),
|
||||
[&sourceDir,
|
||||
&buildDir](const Utils::FilePath &p) {
|
||||
return p.isChildOf(sourceDir)
|
||||
|| p.isChildOf(buildDir);
|
||||
});
|
||||
}
|
||||
|
||||
std::unique_ptr<CMakeProjectNode> BuildDirManager::generateProjectTree(
|
||||
|
@@ -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()
|
||||
|
Reference in New Issue
Block a user