summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2024-10-07 13:11:31 (GMT)
committerKitware Robot <kwrobot@kitware.com>2024-10-07 13:11:48 (GMT)
commit5b7ab1818bc5f5cb26e46f611fb2607bf42e8aca (patch)
tree4adb579d41994d596bc85592b0b720f836161d00 /Tests/RunCMake
parent9a14348a2c2816569a1d8f873f2b9e6da37aacc6 (diff)
parentb80aa1d3a3ba1ad351ad57c42361408a72f7254d (diff)
downloadCMake-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')
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/InvalidOption-stderr.txt2
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/MultiplePresets.json.in41
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/RepeatedPresetArg.cmake3
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/RunCMakeTest.cmake11
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/SinglePresetArg.cmake3
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()