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;