aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2013-06-08 21:50:42 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2013-06-08 22:00:31 +0200
commit347e6f68b2c99605787bd98b61fe30b1d26c938d (patch)
tree3c50118375e11eff5036e197243140a1d19f9cc1 /CMakeLists.txt
parent30ee238bbc8f12a5adecc6a194627d608628ff28 (diff)
downloadsensei-raw-ctl-347e6f68b2c99605787bd98b61fe30b1d26c938d.tar.gz
sensei-raw-ctl-347e6f68b2c99605787bd98b61fe30b1d26c938d.tar.xz
sensei-raw-ctl-347e6f68b2c99605787bd98b61fe30b1d26c938d.zip
Generate a most basic manpage with help2man
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt23
1 files changed, 23 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 35b3ce6..69b3d17 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -53,6 +53,29 @@ if (BUILD_GUI)
DESTINATION ${CMAKE_INSTALL_BINDIR})
endif (BUILD_GUI)
+find_program (HELP2MAN_EXECUTABLE help2man)
+if (NOT HELP2MAN_EXECUTABLE)
+ message (FATAL_ERROR "help2man not found")
+endif ()
+
+foreach (page ${PROJECT_NAME})
+ set (page_output "${PROJECT_BINARY_DIR}/${page}.1")
+ list (APPEND project_MAN_PAGES "${page_output}")
+ add_custom_command (OUTPUT ${page_output}
+ COMMAND ${HELP2MAN_EXECUTABLE} -N
+ "${PROJECT_BINARY_DIR}/${page}" -o ${page_output}
+ DEPENDS ${PROJECT_NAME}
+ COMMENT "Generating man page for ${page}" VERBATIM)
+endforeach ()
+
+add_custom_target (docs ALL DEPENDS ${project_MAN_PAGES})
+
+foreach (page ${project_MAN_PAGES})
+ string (REGEX MATCH "\\.([0-9])" manpage_suffix "${page}")
+ install (FILES "${page}"
+ DESTINATION "${CMAKE_INSTALL_MANDIR}/man${CMAKE_MATCH_1}")
+endforeach ()
+
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "SteelSeries Sensei Raw control utility")
set (CPACK_PACKAGE_VERSION ${project_VERSION})
set (CPACK_PACKAGE_VENDOR "Premysl Janouch")