diff options
author | Brad King <brad.king@kitware.com> | 2024-10-07 13:11:31 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2024-10-07 13:11:48 (GMT) |
commit | 5b7ab1818bc5f5cb26e46f611fb2607bf42e8aca (patch) | |
tree | 4adb579d41994d596bc85592b0b720f836161d00 /Tests/RunCMake | |
parent | 9a14348a2c2816569a1d8f873f2b9e6da37aacc6 (diff) | |
parent | b80aa1d3a3ba1ad351ad57c42361408a72f7254d (diff) | |
download | CMake-5b7ab1818bc5f5cb26e46f611fb2607bf42e8aca.zip CMake-5b7ab1818bc5f5cb26e46f611fb2607bf42e8aca.tar.gz CMake-5b7ab1818bc5f5cb26e46f611fb2607bf42e8aca.tar.bz2 |
Merge topic 'cmake--workflow-preset'
b80aa1d3a3 preset: Easier command line interface for Workflow Presets
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: scivision <michael@scivision.dev>
Merge-request: !9866
Diffstat (limited to 'Tests/RunCMake')
5 files changed, 58 insertions, 2 deletions
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/InvalidOption-stderr.txt b/Tests/RunCMake/CMakePresetsWorkflow/InvalidOption-stderr.txt index 049ff54..8e23c9b 100644 --- a/Tests/RunCMake/CMakePresetsWorkflow/InvalidOption-stderr.txt +++ b/Tests/RunCMake/CMakePresetsWorkflow/InvalidOption-stderr.txt @@ -1,5 +1,5 @@ ^Unknown argument -DINVALID_OPTION -Usage: cmake --workflow \[options\] +Usage: cmake --workflow <options> Options: --preset <preset> = Workflow preset to execute\. --list-presets = List available workflow presets\. diff --git a/Tests/RunCMake/CMakePresetsWorkflow/MultiplePresets.json.in b/Tests/RunCMake/CMakePresetsWorkflow/MultiplePresets.json.in new file mode 100644 index 0000000..9e7dcb8 --- /dev/null +++ b/Tests/RunCMake/CMakePresetsWorkflow/MultiplePresets.json.in @@ -0,0 +1,41 @@ +{ + "version": 6, + "configurePresets": [ + { + "name": "SinglePresetArg", + "generator": "@RunCMake_GENERATOR@", + "cacheVariables": + { + "WORKFLOW_PRESET": "SinglePresetArg" + } + }, + { + "name": "RepeatedPresetArg", + "generator": "@RunCMake_GENERATOR@", + "cacheVariables": + { + "WORKFLOW_PRESET": "RepeatedPresetArg" + } + } + ], + "workflowPresets": [ + { + "name": "SinglePresetArg", + "steps": [ + { + "type": "configure", + "name": "SinglePresetArg" + } + ] + }, + { + "name": "RepeatedPresetArg", + "steps": [ + { + "type": "configure", + "name": "RepeatedPresetArg" + } + ] + } + ] +} diff --git a/Tests/RunCMake/CMakePresetsWorkflow/RepeatedPresetArg.cmake b/Tests/RunCMake/CMakePresetsWorkflow/RepeatedPresetArg.cmake new file mode 100644 index 0000000..b508d1c --- /dev/null +++ b/Tests/RunCMake/CMakePresetsWorkflow/RepeatedPresetArg.cmake @@ -0,0 +1,3 @@ +if(WORKFLOW_PRESET STREQUAL "RepeatedPresetArg") + message(FATAL_ERROR "First preset argument used instead of repeated preset argument") +endif() diff --git a/Tests/RunCMake/CMakePresetsWorkflow/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresetsWorkflow/RunCMakeTest.cmake index 550600a..8c1002d 100644 --- a/Tests/RunCMake/CMakePresetsWorkflow/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMakePresetsWorkflow/RunCMakeTest.cmake @@ -45,7 +45,9 @@ function(run_cmake_workflow_presets name) set(RunCMake-check-file "check.cmake") endif() - if(eq) + if(CMakePresets_DIRECT_ARG) + set(preset_arg "${name}") + elseif(eq) set(eq 0 PARENT_SCOPE) set(preset_arg "--preset=${name}") else() @@ -87,3 +89,10 @@ file(MAKE_DIRECTORY "${RunCMake_BINARY_DIR}/Fresh/build") file(WRITE "${RunCMake_BINARY_DIR}/Fresh/build/CMakeCache.txt" "FRESH_CONFIGURE:BOOL=OFF\n") run_cmake_workflow_presets(Fresh --fresh) unset(RunCMake_TEST_NO_CLEAN) + +set(CMakePresets_DIRECT_ARG TRUE) +set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/MultiplePresets.json.in") +run_cmake_workflow_presets(SinglePresetArg) +run_cmake_workflow_presets(RepeatedPresetArg --preset SinglePresetArg) +unset(CMakePresets_FILE) +unset(CMakePresets_DIRECT_ARG) diff --git a/Tests/RunCMake/CMakePresetsWorkflow/SinglePresetArg.cmake b/Tests/RunCMake/CMakePresetsWorkflow/SinglePresetArg.cmake new file mode 100644 index 0000000..13b754a --- /dev/null +++ b/Tests/RunCMake/CMakePresetsWorkflow/SinglePresetArg.cmake @@ -0,0 +1,3 @@ +if(NOT WORKFLOW_PRESET STREQUAL "SinglePresetArg") + message(FATAL_ERROR "Expected 'SinglePresetArg' workflow preset, but actual value is ${WORKFLOW_PRESET}") +endif() |