From 242f2dbeaaab223e4c9f1412a086c1ea5588d85e Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Mon, 25 Jan 2021 20:00:53 +0100 Subject: [PATCH] CMakeProjectManager: Use buildDirectory instead of "." When issuing cmake --build "." as an user I don't get to see which build directory is being actually built. To make things worse in project settings the build directory field is disabled and cannot be copied. Change-Id: Idf862ba1df68cde55e9785c934f67393da6c1616 Reviewed-by: Eike Ziller --- src/plugins/cmakeprojectmanager/cmakebuildstep.cpp | 5 ++++- src/plugins/cmakeprojectmanager/cmakeproject.cpp | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp b/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp index 924333f107e..5ac0e381676 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp @@ -379,7 +379,10 @@ CommandLine CMakeBuildStep::cmakeCommand() const CMakeTool *tool = CMakeKitAspect::cmakeTool(kit()); Utils::CommandLine cmd(tool ? tool->cmakeExecutable() : Utils::FilePath(), {}); - cmd.addArgs({"--build", "."}); + QString buildDirectory = "."; + if (buildConfiguration()) + buildDirectory = buildConfiguration()->buildDirectory().toString(); + cmd.addArgs({"--build", buildDirectory}); cmd.addArg("--target"); cmd.addArgs(Utils::transform(m_buildTargets, [this](const QString &s) { diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp index 8e0014c87bf..9a5737064e0 100644 --- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp @@ -134,7 +134,11 @@ MakeInstallCommand CMakeProject::makeInstallCommand(const Target *target, config << "--config" << bc->cmakeBuildType(); } - cmd.arguments << "--build" << "." << "--target" << installTarget << config; + QString buildDirectory = "."; + if (bc) + buildDirectory = bc->buildDirectory().toString(); + + cmd.arguments << "--build" << buildDirectory << "--target" << installTarget << config; cmd.environment.set("DESTDIR", QDir::toNativeSeparators(installRoot)); return cmd;