aboutsummaryrefslogtreecommitdiff
path: root/CMake
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2015-12-01 15:57:03 -0500
committerDrew DeVault <sir@cmpwn.com>2015-12-01 15:57:03 -0500
commitfc01f04c93c0de2a0cdcee946ac0131b86e18342 (patch)
tree204ba2fbc20298af8f159cd648c710b3a346135a /CMake
parent297d8b3f02a97c8b23fedd4185016e785f7e2fda (diff)
parent38d4ee9f5030ad8bf383c8c24b0b13b20dbc45de (diff)
Merge pull request #287 from christophgysin/cmake
cmake: extract config from toplevel CMakeLists.txt
Diffstat (limited to 'CMake')
-rw-r--r--CMake/Manpage.cmake31
1 files changed, 31 insertions, 0 deletions
diff --git a/CMake/Manpage.cmake b/CMake/Manpage.cmake
new file mode 100644
index 00000000..4842387e
--- /dev/null
+++ b/CMake/Manpage.cmake
@@ -0,0 +1,31 @@
+find_package(A2X REQUIRED)
+
+add_custom_target(man ALL)
+
+function(add_manpage name section)
+ add_custom_command(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${name}.${section}
+ COMMAND ${A2X_COMMAND}
+ --no-xmllint
+ --doctype manpage
+ --format manpage
+ -D ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
+ ${CMAKE_CURRENT_SOURCE_DIR}/${name}.${section}.txt
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${name}.${section}.txt
+ COMMENT Generating manpage for ${name}.${section}
+ )
+
+ add_custom_target(man-${name}.${section}
+ DEPENDS
+ ${CMAKE_CURRENT_BINARY_DIR}/${name}.${section}
+ )
+ add_dependencies(man
+ man-${name}.${section}
+ )
+
+ install(
+ FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${name}.${section}
+ DESTINATION share/man/man${section}
+ COMPONENT documentation
+ )
+endfunction()