Skip to content

Commit c510e01

Browse files
committed
cmake: Add a CMakePresets.json for default configuration with Ninja &
MSVC
1 parent 4e9d79d commit c510e01

File tree

2 files changed

+163
-0
lines changed

2 files changed

+163
-0
lines changed

CMakePresets.json

+159
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
{
2+
"version": 5,
3+
"configurePresets": [
4+
{
5+
"name": "common",
6+
"binaryDir": "${sourceDir}/build/${presetName}",
7+
"hidden": true,
8+
"cacheVariables": {
9+
"CMAKE_EXPORT_COMPILE_COMMANDS": true
10+
}
11+
},
12+
{
13+
"name": "build-debug",
14+
"hidden": true,
15+
"cacheVariables": {
16+
"CMAKE_BUILD_TYPE": "Debug"
17+
}
18+
},
19+
{
20+
"name": "build-relwithdebinfo",
21+
"hidden": true,
22+
"cacheVariables": {
23+
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
24+
}
25+
},
26+
{
27+
"name": "build-release",
28+
"hidden": true,
29+
"cacheVariables": {
30+
"CMAKE_BUILD_TYPE": "Release"
31+
}
32+
},
33+
{
34+
"name": "ninja",
35+
"hidden": true,
36+
"generator": "Ninja"
37+
},
38+
{
39+
"name": "qt6",
40+
"hidden": true,
41+
"cacheVariables": {
42+
"USE_QT5": false
43+
}
44+
},
45+
{
46+
"name": "qt5",
47+
"hidden": true,
48+
"cacheVariables": {
49+
"USE_QT5": true
50+
}
51+
},
52+
{
53+
"name": "ninja-debug",
54+
"displayName": "Ninja Debug",
55+
"description": "Build in Debug with Ninja generator",
56+
"inherits": ["common", "ninja", "build-debug", "qt6"]
57+
},
58+
{
59+
"name": "ninja-relwithdebinfo",
60+
"displayName": "Ninja RelWithDebInfo",
61+
"description": "Build in RelWithDebInfo with Ninja generator",
62+
"inherits": ["common", "ninja", "build-relwithdebinfo", "qt6"]
63+
},
64+
{
65+
"name": "ninja-release",
66+
"displayName": "Ninja Release",
67+
"description": "Build in Release with Ninja generator",
68+
"inherits": ["common", "ninja", "build-release", "qt6"]
69+
},
70+
{
71+
"name": "ninja-multi",
72+
"displayName": "Ninja Multi-Config",
73+
"description": "Default build using Ninja Multi-Config generator",
74+
"generator": "Ninja Multi-Config",
75+
"inherits": ["common", "ninja", "qt6"]
76+
},
77+
{
78+
"name": "msvc",
79+
"hidden": true,
80+
"condition": {
81+
"type": "equals",
82+
"lhs": "${hostSystemName}",
83+
"rhs": "Windows"
84+
},
85+
"cacheVariables": {
86+
"CMAKE_MSVC_RUNTIME_LIBRARY": "MultiThreadedDLL"
87+
}
88+
},
89+
{
90+
"name": "msvc-17",
91+
"inherits": ["common", "msvc", "qt6"],
92+
"displayName": "Visual Studio 2022",
93+
"generator": "Visual Studio 17 2022",
94+
"description": "Configure using Visual Studio 17 2022 generator"
95+
}
96+
],
97+
"buildPresets": [
98+
{
99+
"name": "build-debug",
100+
"configuration": "Debug",
101+
"hidden": true
102+
},
103+
{
104+
"name": "build-relwithdebinfo",
105+
"configuration": "RelWithDebInfo",
106+
"hidden": true
107+
},
108+
{
109+
"name": "build-release",
110+
"configuration": "Release",
111+
"hidden": true
112+
},
113+
{
114+
"name": "ninja-debug",
115+
"configurePreset": "ninja-debug",
116+
"inherits": "build-debug"
117+
},
118+
{
119+
"name": "ninja-relwithdebinfo",
120+
"configurePreset": "ninja-relwithdebinfo",
121+
"inherits": "build-relwithdebinfo"
122+
},
123+
{
124+
"name": "ninja-release",
125+
"configurePreset": "ninja-release",
126+
"inherits": "build-release"
127+
},
128+
{
129+
"name": "ninja-multi-debug",
130+
"configurePreset": "ninja-multi",
131+
"inherits": "build-debug"
132+
},
133+
{
134+
"name": "ninja-multi-relwithdebinfo",
135+
"configurePreset": "ninja-multi",
136+
"inherits": "build-relwithdebinfo"
137+
},
138+
{
139+
"name": "ninja-multi-release",
140+
"configurePreset": "ninja-multi",
141+
"inherits": "build-release"
142+
},
143+
{
144+
"name": "msvc-17-debug",
145+
"configurePreset": "msvc-17",
146+
"inherits": "build-debug"
147+
},
148+
{
149+
"name": "msvc-17-relwithdebinfo",
150+
"configurePreset": "msvc-17",
151+
"inherits": "build-relwithdebinfo"
152+
},
153+
{
154+
"name": "msvc-17-release",
155+
"configurePreset": "msvc-17",
156+
"inherits": "build-release"
157+
}
158+
]
159+
}

CMakePresets.json.license

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
SPDX-FileCopyrightText: 2023 Klarälvdalens Datakonsult AB, a KDAB Group company <[email protected]>
2+
SPDX-FileContributor: Olivier Le Doeuff <[email protected]>
3+
4+
SPDX-License-Identifier: MIT OR Apache-2.0

0 commit comments

Comments
 (0)