From a9995e23b1fc41960b23042102150a088cf00f38 Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Tue, 4 Jun 2024 16:54:56 +0200 Subject: [PATCH] CMakePM: Allow CMake custom build types CMake can have custom build types. Qt Creator can rename existing build types. This changeset allows having a custom build type like for example: * CMAKE_BUILD_TYPE=MyRelease * CMAKE_CONFIGURATION_TYPES=MyDebug;MyRelease Fixes: QTCREATORBUG-30014 Change-Id: I3d81d9ff867bfaab29aaf1741606f9c586da82e0 Reviewed-by: Alessandro Portale --- src/plugins/cmakeprojectmanager/cmakeprojectimporter.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectimporter.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectimporter.cpp index 5189c7934fd..998ccbf7ca8 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectimporter.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprojectimporter.cpp @@ -1124,6 +1124,11 @@ const QList CMakeProjectImporter::buildInfoList(void *directoryData) && data->hasQmlDebugging) buildType = CMakeBuildConfigurationFactory::BuildTypeProfile; BuildInfo info = CMakeBuildConfigurationFactory::createBuildInfo(buildType); + + // For CMake Presets use the provided build type if is not mapped to a known type + if (!data->cmakePreset.isEmpty() && info.buildType == BuildConfiguration::Unknown) + info.typeName = info.displayName = QString::fromUtf8(data->cmakeBuildType); + info.buildDirectory = data->buildDirectory; QVariantMap config = info.extraInfo.toMap(); // new empty, or existing one from createBuildInfo