Skip to content

Commit ad7d80a

Browse files
committed
Add CMake build
- adds basic cpack integration
1 parent 87852e8 commit ad7d80a

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

CMakeLists.txt

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
cmake_minimum_required(VERSION 3.26)
2+
3+
project(rolldice
4+
VERSION 1.16
5+
LANGUAGES C
6+
DESCRIPTION "rolls virtual dice")
7+
8+
add_executable(rolldice rolldice.c main.c)
9+
target_include_directories(rolldice PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
10+
target_link_libraries(rolldice PUBLIC readline)
11+
12+
# man page with sed
13+
add_custom_command(
14+
OUTPUT rolldice.6.gz
15+
COMMAND sed s/__VERSION__/${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}/ ${CMAKE_CURRENT_SOURCE_DIR}/rolldice.6.src > rolldice.6
16+
COMMAND gzip -n -9 -c ${CMAKE_CURRENT_BINARY_DIR}/rolldice.6 > rolldice.6.gz
17+
COMMENT "Running sed to generate man page"
18+
VERBATIM
19+
)
20+
add_custom_target(generate_man ALL
21+
DEPENDS rolldice.6.gz)
22+
23+
install(TARGETS rolldice)
24+
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/rolldice.6.gz TYPE MAN)
25+
26+
# CPack options
27+
set(CPACK_PACKAGE_VENDOR "Stevie Strickland")
28+
set(CPACK_PACKAGE_CONTACT "[email protected]")
29+
set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/sstrickl/rolldice")
30+
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/DESCRIPTION")
31+
32+
set(CPACK_RPM_PACKAGE_LICENSE "GPL-2.0-only")
33+
set(CPACK_RPM_PACKAGE_REQUIRES "readline")
34+
35+
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libreadline8 | libreadline7")
36+
include(CPack)

DESCRIPTION

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
rolls virtual dice.
2+
3+
The dice strings passed on the command line contain information on the dice to roll in a format comparable to the format used in
4+
most role playing games.

0 commit comments

Comments
 (0)