forked from qt-creator/qt-creator
CMakeProjectManager: Support for multi-config generators
CMake has multi-config generators like: * Visual Studio * Xcode * Ninja Multi-Config The first two have different special targets for "all", "install", "package", "test" namely: "ALL_BUILD", "INSTALL", "PACKAGE", "RUN_TESTS". All of them need to get the build type passed via "--config <build- type>" and not via "CMAKE_BUILD_TYPE". The multi-config generators will use only one build directory. Fixes: QTCREATORBUG-24984 Change-Id: I8aa7ff73ce2af1e163b21a6504d26fcf95530edf Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -25,6 +25,8 @@
|
||||
|
||||
#include "cmakeproject.h"
|
||||
|
||||
#include "cmakebuildconfiguration.h"
|
||||
#include "cmakebuildsystem.h"
|
||||
#include "cmakebuildstep.h"
|
||||
#include "cmakekitinformation.h"
|
||||
#include "cmakeprojectconstants.h"
|
||||
@@ -119,7 +121,21 @@ MakeInstallCommand CMakeProject::makeInstallCommand(const Target *target,
|
||||
cmd.command = tool->cmakeExecutable();
|
||||
}
|
||||
}
|
||||
cmd.arguments << "--build" << "." << "--target" << "install";
|
||||
|
||||
QString installTarget = "install";
|
||||
QStringList config;
|
||||
|
||||
auto bs = qobject_cast<CMakeBuildSystem*>(target->buildSystem());
|
||||
auto bc = qobject_cast<CMakeBuildConfiguration*>(target->activeBuildConfiguration());
|
||||
if (bs && bc) {
|
||||
if (bs->usesAllCapsTargets())
|
||||
installTarget = "INSTALL";
|
||||
if (bs->isMultiConfig())
|
||||
config << "--config" << bc->cmakeBuildType();
|
||||
}
|
||||
|
||||
cmd.arguments << "--build" << "." << "--target" << installTarget << config;
|
||||
|
||||
cmd.environment.set("DESTDIR", QDir::toNativeSeparators(installRoot));
|
||||
return cmd;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user