diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2016-10-09 15:47:25 +0200 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2016-10-09 15:47:25 +0200 |
commit | 43da7cd3c94247f8b7e5d6bec0c6ac491d6ba817 (patch) | |
tree | 16f855f2a3a1f009717df1f9dd39bbf3af3ffa27 /CMakeLists.txt | |
parent | 1f565b4d32b34be1702236a8df9adfaed8dcc684 (diff) | |
download | nncmpp-43da7cd3c94247f8b7e5d6bec0c6ac491d6ba817.tar.gz nncmpp-43da7cd3c94247f8b7e5d6bec0c6ac491d6ba817.tar.xz nncmpp-43da7cd3c94247f8b7e5d6bec0c6ac491d6ba817.zip |
Generate a manual page
Also mention our fancy new stream feature in the README.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index c7a455c..fcb5ba0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,11 +69,35 @@ target_link_libraries (${PROJECT_NAME} ${UNISTRING_LIBRARIES} ${NCURSESW_LIBRARIES} termo-static ${curl_LIBRARIES}) add_threads (${PROJECT_NAME}) -# The files to be installed +# Installation include (GNUInstallDirs) install (TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR}) install (FILES LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR}) +# Generate documentation from program help +find_program (HELP2MAN_EXECUTABLE help2man) +if (NOT HELP2MAN_EXECUTABLE) + message (FATAL_ERROR "help2man not found") +endif (NOT HELP2MAN_EXECUTABLE) + +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 ${page} + COMMENT "Generating man page for ${page}" VERBATIM) +endforeach (page) + +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 (page) + # CPack set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "MPD client") set (CPACK_PACKAGE_VENDOR "Premysl Janouch") |