aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp')
-rw-r--r--src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp
index 6a55730d50c..f681a83d060 100644
--- a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp
@@ -195,10 +195,7 @@ CMakeBuildSystem::CMakeBuildSystem(CMakeBuildConfiguration *bc)
connect(&m_reader, &FileApiReader::errorOccurred, this, &CMakeBuildSystem::handleParsingFailed);
connect(&m_reader, &FileApiReader::dirty, this, &CMakeBuildSystem::becameDirty);
- connect(SessionManager::instance(),
- &SessionManager::projectAdded,
- this,
- &CMakeBuildSystem::wireUpConnections);
+ wireUpConnections();
}
CMakeBuildSystem::~CMakeBuildSystem()
@@ -712,13 +709,8 @@ void CMakeBuildSystem::handleParsingFailed(const QString &msg)
combineScanAndParse();
}
-void CMakeBuildSystem::wireUpConnections(const Project *p)
+void CMakeBuildSystem::wireUpConnections()
{
- if (p != project())
- return; // That's not us...
-
- disconnect(SessionManager::instance(), nullptr, this, nullptr);
-
// At this point the entire project will be fully configured, so let's connect everything and
// trigger an initial parser run
@@ -740,6 +732,12 @@ void CMakeBuildSystem::wireUpConnections(const Project *p)
setParametersAndRequestParse(BuildDirParameters(cmakeBuildConfiguration()),
CMakeBuildSystem::REPARSE_DEFAULT);
});
+ connect(project(), &Project::activeTargetChanged, this, [this]() {
+ // Build configuration has changed:
+ qCDebug(cmakeBuildSystemLog) << "Requesting parse due to active target changed";
+ setParametersAndRequestParse(BuildDirParameters(cmakeBuildConfiguration()),
+ CMakeBuildSystem::REPARSE_DEFAULT);
+ });
// BuildConfiguration changed:
connect(cmakeBuildConfiguration(), &CMakeBuildConfiguration::environmentChanged, this, [this]() {