blob: b89a11a6af1b98dba6b9493175e7c7c35d471a7d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
include(RunCMake)
# Presets do not support legacy VS generator name architecture suffix.
if(RunCMake_GENERATOR MATCHES "^(Visual Studio [0-9]+ [0-9]+) ")
set(RunCMake_GENERATOR "${CMAKE_MATCH_1}")
endif()
function(run_cmake_workflow_presets name)
set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/${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)
file(REMOVE_RECURSE "${RunCMake_TEST_SOURCE_DIR}")
file(MAKE_DIRECTORY "${RunCMake_TEST_SOURCE_DIR}")
set(CASE_NAME "${name}")
set(CASE_SOURCE_DIR "${RunCMake_SOURCE_DIR}")
configure_file("${RunCMake_SOURCE_DIR}/CMakeLists.txt.in" "${RunCMake_TEST_SOURCE_DIR}/CMakeLists.txt" @ONLY)
if(NOT CMakePresets_FILE)
set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/${name}.json.in")
endif()
if(EXISTS "${CMakePresets_FILE}")
configure_file("${CMakePresets_FILE}" "${RunCMake_TEST_SOURCE_DIR}/CMakePresets.json" @ONLY)
endif()
if(NOT CMakeUserPresets_FILE)
set(CMakeUserPresets_FILE "${RunCMake_SOURCE_DIR}/${name}User.json.in")
endif()
if(EXISTS "${CMakeUserPresets_FILE}")
configure_file("${CMakeUserPresets_FILE}" "${RunCMake_TEST_SOURCE_DIR}/CMakeUserPresets.json" @ONLY)
endif()
foreach(ASSET ${CMakePresets_ASSETS})
configure_file("${RunCMake_SOURCE_DIR}/${ASSET}.in" "${RunCMake_TEST_SOURCE_DIR}/${ASSET}" @ONLY)
endforeach()
if(EXISTS "${RunCMake_SOURCE_DIR}/${name}-check.cmake")
set(RunCMake-check-file "${name}-check.cmake")
else()
set(RunCMake-check-file "check.cmake")
endif()
if(eq)
set(eq 0 PARENT_SCOPE)
set(preset_arg "--preset=${name}")
else()
set(eq 1 PARENT_SCOPE)
set(preset_arg "--preset" "${name}")
endif()
run_cmake_command("${name}" "${CMAKE_COMMAND}" "--workflow" ${preset_arg} ${ARGN})
endfunction()
set(CMakePresets_SCHEMA_EXPECTED_RESULT 1)
run_cmake_workflow_presets(UnsupportedVersion)
set(CMakePresets_SCHEMA_EXPECTED_RESULT 0)
run_cmake_workflow_presets(NoWorkflowSteps)
run_cmake_workflow_presets(FirstStepNotConfigure)
run_cmake_workflow_presets(SecondStepConfigure)
run_cmake_workflow_presets(NonexistentStep)
run_cmake_workflow_presets(UnreachableStep)
run_cmake_workflow_presets(WorkflowStepHidden)
run_cmake_workflow_presets(WorkflowStepDisabled)
run_cmake_workflow_presets(WorkflowStepInvalidMacro)
run_cmake_workflow_presets(ConfigureStepMismatch)
set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/Good.json.in")
set(CMakeUserPresets_FILE "${RunCMake_SOURCE_DIR}/GoodUser.json.in")
set(CMakePresets_ASSETS cpack_staging.cmake)
run_cmake_workflow_presets(Good)
run_cmake_workflow_presets(GoodUser)
run_cmake_workflow_presets(BadExitCode)
unset(CMakePresets_FILE)
unset(CMakeUserPresets_FILE)
unset(CMakePresets_ASSETS)
run_cmake_workflow_presets(ListPresets --list-presets)
|