Skip to content

Commit 508b9a2

Browse files
committed
add package presets
1 parent cb1dcbb commit 508b9a2

File tree

5 files changed

+47
-2
lines changed

5 files changed

+47
-2
lines changed

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@ project(
1010

1111
if(FEATURE_TESTS)
1212
enable_testing()
13+
find_package(Catch2 REQUIRED)
1314
endif()
1415

1516
add_subdirectory(library)
1617
add_subdirectory(app)
18+
19+
set(CPACK_PACKAGE_FILE_NAME
20+
"${CMAKE_PROJECT_NAME}-${CMAKE_PROJECT_VERSION}-${CMAKE_SYSTEM_NAME}-${CMAKE_BUILD_TYPE}-${CMAKE_CXX_COMPILER_ID}-${CMAKE_CXX_COMPILER_VERSION}"
21+
)
22+
include(CPack)

CMakePresets.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,27 +122,31 @@
122122
},
123123
{
124124
"name": "Windows-msvc-Debug",
125+
"displayName": "win-msvc-debug",
125126
"inherits": [
126127
"confs-windows-msvc-common",
127128
"debug"
128129
]
129130
},
130131
{
131132
"name": "Windows-msvc-Release",
133+
"displayName": "win-msvc-release",
132134
"inherits": [
133135
"confs-windows-msvc-common",
134136
"release"
135137
]
136138
},
137139
{
138140
"name": "Windows-llvm-Debug",
141+
"displayName": "win-llvm-debug",
139142
"inherits": [
140143
"confs-windows-llvm-common",
141144
"debug"
142145
]
143146
},
144147
{
145148
"name": "Windows-llvm-Release",
149+
"displayName": "win-llvm-release",
146150
"inherits": [
147151
"confs-windows-llvm-common",
148152
"release"
@@ -180,18 +184,22 @@
180184
"buildPresets": [
181185
{
182186
"name": "Windows-msvc-Debug",
187+
"displayName": "win-msvc-debug",
183188
"configurePreset": "Windows-msvc-Debug"
184189
},
185190
{
186191
"name": "Windows-msvc-Release",
192+
"displayName": "win-msvc-release",
187193
"configurePreset": "Windows-msvc-Release"
188194
},
189195
{
190196
"name": "Windows-llvm-Debug",
197+
"displayName": "win-llvm-debug",
191198
"configurePreset": "Windows-llvm-Debug"
192199
},
193200
{
194201
"name": "Windows-llvm-Release",
202+
"displayName": "win-llvm-release",
195203
"configurePreset": "Windows-llvm-Release"
196204
},
197205
{
@@ -225,20 +233,41 @@
225233
},
226234
{
227235
"name": "test-Windows-msvc-Debug",
236+
"displayName": "test-win-msvc-debug",
228237
"description": "Enable output and stop on failure",
229238
"inherits": "test-common",
230239
"configurePreset": "Windows-msvc-Debug"
231240
},
232241
{
233242
"name": "test-Windows-llvm-Debug",
243+
"displayName": "test-win-llvm-debug",
234244
"description": "Enable output and stop on failure",
235245
"inherits": "test-common",
236246
"configurePreset": "Windows-llvm-Debug"
237247
}
238248
],
249+
"packagePresets": [
250+
{
251+
"name": "package-Windows-msvc-Debug",
252+
"displayName": "pkg-windows-msvc-debug",
253+
"configurePreset": "Windows-msvc-Debug",
254+
"generators": [
255+
"TGZ"
256+
]
257+
},
258+
{
259+
"name": "package-Windows-llvm-Debug",
260+
"displayName": "pkg-windows-llvm-debug",
261+
"configurePreset": "Windows-llvm-Debug",
262+
"generators": [
263+
"TGZ"
264+
]
265+
}
266+
],
239267
"workflowPresets": [
240268
{
241269
"name": "Windows-msvc-Debug",
270+
"displayName": "win-msvc-debug",
242271
"steps": [
243272
{
244273
"type": "configure",
@@ -251,11 +280,16 @@
251280
{
252281
"type": "test",
253282
"name": "test-Windows-msvc-Debug"
283+
},
284+
{
285+
"type": "package",
286+
"name": "package-Windows-msvc-Debug"
254287
}
255288
]
256289
},
257290
{
258291
"name": "Windows-llvm-Debug",
292+
"displayName": "win-llvm-debug",
259293
"steps": [
260294
{
261295
"type": "configure",
@@ -268,6 +302,10 @@
268302
{
269303
"type": "test",
270304
"name": "test-Windows-llvm-Debug"
305+
},
306+
{
307+
"type": "package",
308+
"name": "package-Windows-llvm-Debug"
271309
}
272310
]
273311
}

app/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
add_executable(Application App.cpp)
33
target_link_libraries(Application PRIVATE Core)
44
set_target_properties(Application PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Application)
5+
install(TARGETS Application)

library/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ set(LIBRARY_SOURCES
1414
add_library(Core STATIC ${LIBRARY_HEADERS} ${LIBRARY_SOURCES})
1515
target_include_directories(Core PUBLIC ${PROJECT_SOURCE_DIR}/library/include)
1616
target_compile_features(Core PUBLIC cxx_std_17)
17+
install(TARGETS Core)
1718

1819
if (FEATURE_TESTS)
1920
add_subdirectory(${PROJECT_SOURCE_DIR}/library/test)

library/test/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
find_package(Catch2 REQUIRED)
21
include(Catch)
32

43
add_executable(CoreTests ${PROJECT_SOURCE_DIR}/library/test/Tests.cpp)
54
target_link_libraries(CoreTests PRIVATE Core Catch2::Catch2WithMain)
65
target_compile_features(CoreTests PRIVATE cxx_std_17)
7-
set_target_properties(CoreTests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${PROJECT_NAME}/Tests)
6+
set_target_properties(CoreTests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Core/Tests)
87
catch_discover_tests(CoreTests)

0 commit comments

Comments
 (0)