diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2021-07-06 18:36:27 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2021-07-06 18:36:27 (GMT) |
commit | d9a3c9fad52a522da0dcc8093770fb9e59a1e21e (patch) | |
tree | 0dbc142a1ed538c29a927bf8bd07cca4ff982832 | |
parent | 13fa9701490a872effc21f13f3e1c65ca30c71e3 (diff) | |
download | CMake-d9a3c9fad52a522da0dcc8093770fb9e59a1e21e.zip CMake-d9a3c9fad52a522da0dcc8093770fb9e59a1e21e.tar.gz CMake-d9a3c9fad52a522da0dcc8093770fb9e59a1e21e.tar.bz2 |
CMakePresets.json: Make --list-presets show presets with no generator
Fixes: #22389
6 files changed, 23 insertions, 13 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 14f66d9..73f5ad5 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1687,6 +1687,9 @@ void cmake::PrintPresetList(const cmCMakePresetsFile& file) const this->GetRegisteredGenerators(generators, false); auto filter = [&generators](const cmCMakePresetsFile::ConfigurePreset& preset) -> bool { + if (preset.Generator.empty()) { + return true; + } auto condition = [&preset](const GeneratorInfo& info) -> bool { return info.name == preset.Generator; }; diff --git a/Tests/RunCMake/CMakePresets/ListPresets-stdout.txt b/Tests/RunCMake/CMakePresets/ListPresets-stdout.txt index 60d6adb..97eedae 100644 --- a/Tests/RunCMake/CMakePresets/ListPresets-stdout.txt +++ b/Tests/RunCMake/CMakePresets/ListPresets-stdout.txt @@ -1,6 +1,7 @@ ^Not searching for unused variables given on the command line\. Available configure presets: - "zzzzzz" - Sleepy - "aaaaaaaa" - Screaming - "mmmmmm"$ + "zzzzzz" - Sleepy + "aaaaaaaa" - Screaming + "mmmmmm" + "no-generator"$ diff --git a/Tests/RunCMake/CMakePresets/ListPresets.json.in b/Tests/RunCMake/CMakePresets/ListPresets.json.in index 2ef3797..160098c 100644 --- a/Tests/RunCMake/CMakePresets/ListPresets.json.in +++ b/Tests/RunCMake/CMakePresets/ListPresets.json.in @@ -1,5 +1,5 @@ { - "version": 1, + "version": 3, "configurePresets": [ { "name": "zzzzzz", @@ -19,6 +19,9 @@ "binaryDir": "${sourceDir}/build/mmmmmm" }, { + "name": "no-generator" + }, + { "name": "invalid-generator", "generator": "Invalid Generator", "binaryDir": "${sourceDir}/build/invalid" diff --git a/Tests/RunCMake/CMakePresets/ListPresetsHidden-stdout.txt b/Tests/RunCMake/CMakePresets/ListPresetsHidden-stdout.txt index 60d6adb..97eedae 100644 --- a/Tests/RunCMake/CMakePresets/ListPresetsHidden-stdout.txt +++ b/Tests/RunCMake/CMakePresets/ListPresetsHidden-stdout.txt @@ -1,6 +1,7 @@ ^Not searching for unused variables given on the command line\. Available configure presets: - "zzzzzz" - Sleepy - "aaaaaaaa" - Screaming - "mmmmmm"$ + "zzzzzz" - Sleepy + "aaaaaaaa" - Screaming + "mmmmmm" + "no-generator"$ diff --git a/Tests/RunCMake/CMakePresets/ListPresetsNoSuchPreset-stdout.txt b/Tests/RunCMake/CMakePresets/ListPresetsNoSuchPreset-stdout.txt index 60d6adb..97eedae 100644 --- a/Tests/RunCMake/CMakePresets/ListPresetsNoSuchPreset-stdout.txt +++ b/Tests/RunCMake/CMakePresets/ListPresetsNoSuchPreset-stdout.txt @@ -1,6 +1,7 @@ ^Not searching for unused variables given on the command line\. Available configure presets: - "zzzzzz" - Sleepy - "aaaaaaaa" - Screaming - "mmmmmm"$ + "zzzzzz" - Sleepy + "aaaaaaaa" - Screaming + "mmmmmm" + "no-generator"$ diff --git a/Tests/RunCMake/CMakePresets/ListPresetsWorkingDir-stdout.txt b/Tests/RunCMake/CMakePresets/ListPresetsWorkingDir-stdout.txt index 60d6adb..97eedae 100644 --- a/Tests/RunCMake/CMakePresets/ListPresetsWorkingDir-stdout.txt +++ b/Tests/RunCMake/CMakePresets/ListPresetsWorkingDir-stdout.txt @@ -1,6 +1,7 @@ ^Not searching for unused variables given on the command line\. Available configure presets: - "zzzzzz" - Sleepy - "aaaaaaaa" - Screaming - "mmmmmm"$ + "zzzzzz" - Sleepy + "aaaaaaaa" - Screaming + "mmmmmm" + "no-generator"$ |