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 <alessandro.portale@qt.io>
This commit is contained in:
Cristian Adam
2024-06-04 16:54:56 +02:00
parent ba017c03c2
commit a9995e23b1

View File

@@ -1124,6 +1124,11 @@ const QList<BuildInfo> 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