aboutsummaryrefslogtreecommitdiffstats
path: root/docs/CMakeLists.txt
diff options
context:
space:
mode:
authorPiotr Krysik <ptrkrysik@users.noreply.github.com>2017-09-23 18:19:02 +0200
committerGitHub <noreply@github.com>2017-09-23 18:19:02 +0200
commit20510f4fe613bcccc0488e58540caa46054dba64 (patch)
tree261ba2335c0bdf51919cbec44740783358251647 /docs/CMakeLists.txt
parentd890cd3b368abba73003482327ee5740d5dfcf69 (diff)
parentcf5718cdac26054f34599428f4b1b6da45d6866f (diff)
Merge pull request #333 from petterreinholdtsen/install-man
Add cmake rule to generate and install the rst manual page.
Diffstat (limited to 'docs/CMakeLists.txt')
-rw-r--r--docs/CMakeLists.txt22
1 files changed, 22 insertions, 0 deletions
diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt
index f16fbf6..041fc60 100644
--- a/docs/CMakeLists.txt
+++ b/docs/CMakeLists.txt
@@ -33,3 +33,25 @@ if(ENABLE_DOXYGEN)
add_subdirectory(doxygen)
endif(ENABLE_DOXYGEN)
+
+########################################################################
+# Convert manual pages from rst to roff and install them
+########################################################################
+find_program(RST2MAN_EXECUTABLE NAMES rst2man rst2man.py rst2man2 rst2man2.py)
+if(NOT RST2MAN_EXECUTABLE)
+ message(FATAL "rst2man from python-docutils is required to build man pages")
+endif()
+
+function(BUILD_MAN_PAGE _sources _src _dst)
+ add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_dst}"
+ COMMAND ${RST2MAN_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${_src} ${CMAKE_CURRENT_BINARY_DIR}/${_dst}
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_src})
+
+ list(APPEND ${_sources} "${CMAKE_CURRENT_BINARY_DIR}/${_dst}")
+ set(${_sources} ${${_sources}} PARENT_SCOPE)
+
+ add_custom_target(man_${_src} ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_dst})
+endfunction()
+
+build_man_page(MAN1_OUTPUT grgsm_livemon.rst grgsm_livemon.1)
+install(FILES ${MAN1_OUTPUT} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1)