From 7cf6d9c97bbf501dd3949b30cee57b53ed5abc6a Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Tue, 6 Dec 2022 13:07:06 +0100 Subject: [PATCH] CMakeBuildStep: Get rid of m_waiting field Change-Id: Iea737960f57e93fa1e688ed43eedf1bf44204709 Reviewed-by: Cristian Adam --- .../cmakeprojectmanager/cmakebuildstep.cpp | 20 ++++++++----------- .../cmakeprojectmanager/cmakebuildstep.h | 1 - 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp b/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp index 39b0cc2b1db..a6c28dbe86d 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp @@ -319,22 +319,19 @@ void CMakeBuildStep::setupOutputFormatter(Utils::OutputFormatter *formatter) void CMakeBuildStep::doRun() { // Make sure CMake state was written to disk before trying to build: - m_waiting = false; auto bs = static_cast(buildSystem()); + QString message; if (bs->persistCMakeState()) { - emit addOutput(Tr::tr("Persisting CMake state..."), BuildStep::OutputFormat::NormalMessage); - m_waiting = true; - } else if (buildSystem()->isWaitingForParse()) { - emit addOutput(Tr::tr("Running CMake in preparation to build..."), BuildStep::OutputFormat::NormalMessage); - m_waiting = true; - } - - if (m_waiting) { - m_runTrigger = connect(target(), &Target::parsingFinished, - this, [this](bool success) { handleProjectWasParsed(success); }); + message = Tr::tr("Persisting CMake state..."); + } else if (bs->isWaitingForParse()) { + message = Tr::tr("Running CMake in preparation to build..."); } else { runImpl(); + return; } + emit addOutput(message, OutputFormat::NormalMessage); + m_runTrigger = connect(target(), &Target::parsingFinished, + this, [this](bool success) { handleProjectWasParsed(success); }); } void CMakeBuildStep::runImpl() @@ -345,7 +342,6 @@ void CMakeBuildStep::runImpl() void CMakeBuildStep::handleProjectWasParsed(bool success) { - m_waiting = false; disconnect(m_runTrigger); if (isCanceled()) { emit finished(false); diff --git a/src/plugins/cmakeprojectmanager/cmakebuildstep.h b/src/plugins/cmakeprojectmanager/cmakebuildstep.h index 8abedefe94f..21065f6dc53 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildstep.h +++ b/src/plugins/cmakeprojectmanager/cmakebuildstep.h @@ -102,7 +102,6 @@ private: Utils::StringAspect *m_cmakeArguments = nullptr; Utils::StringAspect *m_toolArguments = nullptr; Utils::BoolAspect *m_useiOSAutomaticProvisioningUpdates = nullptr; - bool m_waiting = false; QString m_allTarget = "all"; QString m_installTarget = "install";