From ca735829b4932b04337a2dc1ebcf80efd222bed5 Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 25 Aug 2021 12:09:10 +0200 Subject: [PATCH] CMake: Bark about missing build directory Also, bail out earlier and more directly. Amends e54c63af5e Change-Id: Id5a530b3d6f7548a2f786f3400454253c719acce Reviewed-by: Artem Sokolovskii Reviewed-by: Christian Stenger --- .../cmakeprojectmanager/cmakeprocess.cpp | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/cmakeprocess.cpp b/src/plugins/cmakeprojectmanager/cmakeprocess.cpp index 0cc26380661..e9baa731f67 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprocess.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprocess.cpp @@ -78,7 +78,24 @@ void CMakeProcess::run(const BuildDirParameters ¶meters, const QStringList & QTC_ASSERT(parameters.isValid() && cmake, return); const FilePath buildDirectory = parameters.buildDirectory; - QTC_ASSERT(buildDirectory.exists(), return); + if (!buildDirectory.exists()) { + QString msg = tr("The build directory \"%1\" does not exist") + .arg(buildDirectory.toUserOutput()); + BuildSystem::appendBuildSystemOutput(msg + '\n'); + emit finished(); + return; + } + + if (buildDirectory.needsDevice()) { + if (cmake->cmakeExecutable().host() != buildDirectory.host()) { + QString msg = tr("CMake executable \"%1\" and build directory " + "\"%2\" must be on the same device.") + .arg(cmake->cmakeExecutable().toUserOutput(), buildDirectory.toUserOutput()); + BuildSystem::appendBuildSystemOutput(msg + '\n'); + emit finished(); + return; + } + } const QString srcDir = parameters.sourceDirectory.path(); @@ -109,13 +126,6 @@ void CMakeProcess::run(const BuildDirParameters ¶meters, const QStringList & connect(process.get(), &QtcProcess::finished, this, &CMakeProcess::handleProcessFinished); - if (buildDirectory.needsDevice()) { - if (cmake->cmakeExecutable().host() != buildDirectory.host()) { - m_parser.appendMessage(tr("CMake executable and build dir must be on the same device."), StdErrFormat); - reportCanceled(); - return; - } - } CommandLine commandLine(cmake->cmakeExecutable(), QStringList({"-S", srcDir, "-B", buildDirectory.path()}) + arguments); TaskHub::clearTasks(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM);