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:
Cristian Adam
2021-01-14 16:38:55 +01:00
parent f3d7717b31
commit 6cbdae8070
22 changed files with 238 additions and 140 deletions

View File

@@ -449,8 +449,8 @@ private:
generatorCombo->setCurrentText(CMakeGeneratorKitAspect::generator(kit()));
extraGeneratorCombo->setCurrentText(CMakeGeneratorKitAspect::extraGenerator(kit()));
platformEdit->setText(platformEdit->isEnabled() ? CMakeGeneratorKitAspect::platform(kit()) : QLatin1String("<unsupported>"));
toolsetEdit->setText(toolsetEdit->isEnabled() ? CMakeGeneratorKitAspect::toolset(kit()) : QLatin1String("<unsupported>"));
platformEdit->setText(platformEdit->isEnabled() ? CMakeGeneratorKitAspect::platform(kit()) : QString());
toolsetEdit->setText(toolsetEdit->isEnabled() ? CMakeGeneratorKitAspect::toolset(kit()) : QString());
connect(generatorCombo, &QComboBox::currentTextChanged, updateDialog);
@@ -619,6 +619,14 @@ QStringList CMakeGeneratorKitAspect::generatorArguments(const Kit *k)
return result;
}
bool CMakeGeneratorKitAspect::isMultiConfigGenerator(const Kit *k)
{
const QString generator = CMakeGeneratorKitAspect::generator(k);
return generator.indexOf("Visual Studio") != -1 ||
generator == "Xcode" ||
generator == "Ninja Multi-Config";
}
QVariant CMakeGeneratorKitAspect::defaultValue(const Kit *k) const
{
QTC_ASSERT(k, return QVariant());