-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
33 lines (33 loc) · 1.25 KB
/
CMakeLists.txt
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
cmake_minimum_required (VERSION 3.0)
project (cxl VERSION 0.1.0)
find_package(X11 REQUIRED COMPONENTS Xkbfile)
add_executable(${PROJECT_NAME} cxl.c)
target_compile_definitions(${PROJECT_NAME} PRIVATE VERSION="${PROJECT_VERSION}")
target_link_libraries(${PROJECT_NAME} ${X11_LIBRARIES} ${X11_Xkbfile_LIB})
include(GNUInstallDirs)
install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
find_program(A2X NAMES a2x a2x.py)
find_program(BZIP2 bzip2)
set(MAN ${PROJECT_NAME}.1)
set(MAN_TXT ${MAN}.txt)
set(MAN_TXT_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/${MAN_TXT})
set(MAN_COMPRESSED ${MAN}.bz2)
set(A2X_OPTS -f manpage -a version=${PROJECT_VERSION} -a cmd=${PROJECT_NAME})
add_custom_command(
OUTPUT ${MAN_COMPRESSED}
COMMAND ${CMAKE_COMMAND} -E copy ${MAN_TXT_SOURCE} ${MAN_TXT}
COMMAND ${A2X} ${A2X_OPTS} ${MAN_TXT}
COMMAND ${CMAKE_COMMAND} -E remove ${MAN_TXT}
COMMAND ${BZIP2} -f ${MAN}
DEPENDS ${MAN_TXT_SOURCE}
COMMENT "Preparing man page ${MAN_COMPRESSED}"
VERBATIM
)
add_custom_target(man ALL DEPENDS ${MAN_COMPRESSED})
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/${MAN_COMPRESSED}
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1
)
set(CPACK_GENERATOR "DEB;RPM;TBZ2")
set(CPACK_PACKAGE_CONTACT "Alexander Abrosimov")
include(CPack)