aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetter Reinholdtsen <pere@hungry.com>2017-09-13 09:22:23 +0200
committerPetter Reinholdtsen <pere@hungry.com>2017-09-13 09:39:35 +0200
commit863afc6f51c565733611f26cb3877372f1b0cb92 (patch)
tree619d9ca2824366465a488b3fa70c68624646e3db
parentb6210a6e1961e49ba1c1ca5235394826b75bffb7 (diff)
Add cmake rule to generate and install the rst manual page.
-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)