-
Notifications
You must be signed in to change notification settings - Fork 0
/
workflow.cmake
93 lines (89 loc) · 1.77 KB
/
workflow.cmake
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
cmake_minimum_required(VERSION 3.25)
unset(ARGN)
unset(PRESET)
foreach(i RANGE ${CMAKE_ARGC})
if(NOT DEFINED ARGN)
if (CMAKE_ARGV${i} STREQUAL --)
set(ARGN [[]])
endif()
elseif(NOT DEFINED PRESET)
set(PRESET ${CMAKE_ARGV${i}})
else()
list(APPEND ARGN ${CMAKE_ARGV${i}})
endif()
endforeach()
string(TIMESTAMP UID ${PRESET}-%Y-%m-%d_%H_%M_%S)
file(CONFIGURE OUTPUT CMakeUserPresets.json CONTENT [[
{
"version": 6,
"buildPresets": [
{
"name": "@UID@",
"hidden": true,
"verbose": true,
"configurePreset": "@PRESET@"
},
{
"name": "Debug-@UID@",
"inherits": "@UID@",
"configuration": "Debug"
},
{
"name": "Release-@UID@",
"inherits": "@UID@",
"configuration": "Release"
}
],
"testPresets": [
{
"name": "@UID@",
"hidden": true,
"configurePreset": "@PRESET@",
"output": {
"verbosity": "verbose"
}
},
{
"name": "Debug-@UID@",
"inherits": "@UID@",
"configuration": "Debug"
},
{
"name": "Release-@UID@",
"inherits": "@UID@",
"configuration": "Release"
}
],
"workflowPresets": [
{
"name": "@UID@",
"steps": [
{
"type": "configure",
"name": "@PRESET@"
},
{
"type": "build",
"name": "Debug-@UID@"
},
{
"type": "build",
"name": "Release-@UID@"
},
{
"type": "test",
"name": "Debug-@UID@"
},
{
"type": "test",
"name": "Release-@UID@"
}
]
}
]
}
]] @ONLY)
execute_process(COMMAND
${CMAKE_COMMAND} --workflow --preset ${UID} ${ARGN}
COMMAND_ERROR_IS_FATAL ANY
)