summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/CMakePresetsWorkflow
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2022-10-25 15:13:35 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2022-10-26 16:01:25 (GMT)
commit7ecbe324b0ef02f63676f8431dbbbe8b4217f64f (patch)
treeccf713a19358c59cf7cb3a370079b2c5b1764e52 /Tests/RunCMake/CMakePresetsWorkflow
parent7d9aa0f00cd9f7c2ed3d0c710090e9901c4430e9 (diff)
downloadCMake-7ecbe324b0ef02f63676f8431dbbbe8b4217f64f.zip
CMake-7ecbe324b0ef02f63676f8431dbbbe8b4217f64f.tar.gz
CMake-7ecbe324b0ef02f63676f8431dbbbe8b4217f64f.tar.bz2
cmake --workflow: add --fresh option
Fixes: #24073
Diffstat (limited to 'Tests/RunCMake/CMakePresetsWorkflow')
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/Fresh.cmake4
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/Fresh.json.in21
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/RunCMakeTest.cmake15
3 files changed, 37 insertions, 3 deletions
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/Fresh.cmake b/Tests/RunCMake/CMakePresetsWorkflow/Fresh.cmake
new file mode 100644
index 0000000..4cf999f
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/Fresh.cmake
@@ -0,0 +1,4 @@
+option(FRESH_CONFIGURE "" ON)
+if(NOT FRESH_CONFIGURE)
+ message(FATAL_ERROR "FRESH_CONFIGURE is ${FRESH_CONFIGURE}, should be ON")
+endif()
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/Fresh.json.in b/Tests/RunCMake/CMakePresetsWorkflow/Fresh.json.in
new file mode 100644
index 0000000..4ce0ca5
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/Fresh.json.in
@@ -0,0 +1,21 @@
+{
+ "version": 6,
+ "configurePresets": [
+ {
+ "name": "default",
+ "generator": "@RunCMake_GENERATOR@",
+ "binaryDir": "${sourceDir}/build"
+ }
+ ],
+ "workflowPresets": [
+ {
+ "name": "Fresh",
+ "steps": [
+ {
+ "type": "configure",
+ "name": "default"
+ }
+ ]
+ }
+ ]
+}
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresetsWorkflow/RunCMakeTest.cmake
index c620595..550600a 100644
--- a/Tests/RunCMake/CMakePresetsWorkflow/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMakePresetsWorkflow/RunCMakeTest.cmake
@@ -10,10 +10,12 @@ function(run_cmake_workflow_presets name)
set(RunCMake_TEST_BINARY_DIR "${RunCMake_TEST_SOURCE_DIR}/build")
set(RunCMake_TEST_COMMAND_WORKING_DIRECTORY "${RunCMake_TEST_SOURCE_DIR}")
- set(RunCMake_TEST_NO_CLEAN TRUE)
+ if(NOT RunCMake_TEST_NO_CLEAN)
+ file(REMOVE_RECURSE "${RunCMake_TEST_SOURCE_DIR}")
+ file(MAKE_DIRECTORY "${RunCMake_TEST_SOURCE_DIR}")
+ endif()
- file(REMOVE_RECURSE "${RunCMake_TEST_SOURCE_DIR}")
- file(MAKE_DIRECTORY "${RunCMake_TEST_SOURCE_DIR}")
+ set(RunCMake_TEST_NO_CLEAN TRUE)
set(CASE_NAME "${name}")
set(CASE_SOURCE_DIR "${RunCMake_SOURCE_DIR}")
@@ -78,3 +80,10 @@ unset(CMakePresets_ASSETS)
run_cmake_workflow_presets(ListPresets --list-presets)
run_cmake_workflow_presets(InvalidOption -DINVALID_OPTION)
+
+set(RunCMake_TEST_NO_CLEAN TRUE)
+file(REMOVE_RECURSE "${RunCMake_BINARY_DIR}/Fresh")
+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)