diff options
author | Brad King <brad.king@kitware.com> | 2022-04-12 12:15:54 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2022-04-12 12:16:01 (GMT) |
commit | 8e4af2cb303ee41fa82890d6e3e6b49ccd5aeb1a (patch) | |
tree | 188957e719bffdc163ae6f1985a82630e87631e0 | |
parent | 721aea1eba0d14c11da04118bb1c9ed9e5eef1de (diff) | |
parent | 45299a8f9bd366e7f41b938dfed6df9c3d4eac0d (diff) | |
download | CMake-8e4af2cb303ee41fa82890d6e3e6b49ccd5aeb1a.zip CMake-8e4af2cb303ee41fa82890d6e3e6b49ccd5aeb1a.tar.gz CMake-8e4af2cb303ee41fa82890d6e3e6b49ccd5aeb1a.tar.bz2 |
Merge topic 'correct_list-presets_parsing'
45299a8f9b cmake: --list=presets=[type] doesn't generate incorrect warnings
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7164
-rw-r--r-- | Source/cmakemain.cxx | 5 | ||||
-rw-r--r-- | Tests/RunCMake/CMakePresets/ListConfigurePresetsWorkingDir-stdout.txt | 7 | ||||
-rw-r--r-- | Tests/RunCMake/CMakePresets/RunCMakeTest.cmake | 10 |
3 files changed, 19 insertions, 3 deletions
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 96bf845..28be166 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -308,10 +308,11 @@ int do_cmake(int ac, char const* const* av) parsedArgs.emplace_back("--find-package"); return true; } }, - CommandArgument{ "--list-presets", CommandArgument::Values::Zero, - [&](std::string const&) -> bool { + CommandArgument{ "--list-presets", CommandArgument::Values::ZeroOrOne, + [&](std::string const& value) -> bool { workingMode = cmake::HELP_MODE; parsedArgs.emplace_back("--list-presets"); + parsedArgs.emplace_back(value); return true; } }, }; diff --git a/Tests/RunCMake/CMakePresets/ListConfigurePresetsWorkingDir-stdout.txt b/Tests/RunCMake/CMakePresets/ListConfigurePresetsWorkingDir-stdout.txt new file mode 100644 index 0000000..97eedae --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ListConfigurePresetsWorkingDir-stdout.txt @@ -0,0 +1,7 @@ +^Not searching for unused variables given on the command line\. +Available configure presets: + + "zzzzzz" - Sleepy + "aaaaaaaa" - Screaming + "mmmmmm" + "no-generator"$ diff --git a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake index 449132a..5867efd 100644 --- a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake @@ -71,13 +71,18 @@ function(run_cmake_presets name) set(_unused_cli) endif() + set(_preset "--preset=${name}") + if(CMakePresets_NO_PRESET) + set(_preset) + endif() + set(RunCMake_TEST_COMMAND ${CMAKE_COMMAND} ${_source_args} -DRunCMake_TEST=${name} -DRunCMake_GENERATOR=${RunCMake_GENERATOR} -DCMAKE_MAKE_PROGRAM=${RunCMake_MAKE_PROGRAM} ${_unused_cli} - --preset=${name} + ${_preset} ${ARGN} ) run_cmake(${name}) @@ -288,7 +293,10 @@ run_cmake_presets(ListPresets --list-presets) set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/ListPresetsWorkingDir") set(RunCMake_TEST_NO_CLEAN 1) set(CMakePresets_NO_SOURCE_ARGS 1) +set(CMakePresets_NO_PRESET 1) run_cmake_presets(ListPresetsWorkingDir --list-presets) +run_cmake_presets(ListConfigurePresetsWorkingDir --list-presets=configure) +unset(CMakePresets_NO_PRESET) unset(CMakePresets_NO_SOURCE_ARGS) unset(RunCMake_TEST_NO_CLEAN) unset(RunCMake_TEST_BINARY_DIR) |