forked from qt-creator/qt-creator
CMakePM: Skip default build types for CMakePresets
If a preset has a build directory set, that build directory and build type should be displayed in the initial configuration dialog. Change-Id: I884471cb4d482c92ab091a4043d642828318b4d2 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/session.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <projectexplorer/taskhub.h>
|
||||
|
||||
@@ -1953,6 +1954,22 @@ CMakeBuildConfigurationFactory::CMakeBuildConfigurationFactory()
|
||||
|
||||
FilePath path = forSetup ? Project::projectDirectory(projectPath) : projectPath;
|
||||
|
||||
// Skip the default shadow build directories for build types if we have presets
|
||||
const CMakeConfigItem presetItem = CMakeConfigurationKitAspect::cmakePresetConfigItem(k);
|
||||
if (!presetItem.isNull()) {
|
||||
const QString presetName = presetItem.expandedValue(k);
|
||||
const auto project = qobject_cast<CMakeProject *>(SessionManager::startupProject());
|
||||
|
||||
PresetsDetails::ConfigurePreset configurePreset
|
||||
= Utils::findOrDefault(project->presetsData().configurePresets,
|
||||
[&presetName] (const PresetsDetails::ConfigurePreset &preset) {
|
||||
return preset.name == presetName;
|
||||
});
|
||||
|
||||
if (configurePreset.binaryDir)
|
||||
return result;
|
||||
}
|
||||
|
||||
for (int type = BuildTypeDebug; type != BuildTypeLast; ++type) {
|
||||
BuildInfo info = createBuildInfo(BuildType(type));
|
||||
if (forSetup) {
|
||||
|
Reference in New Issue
Block a user