0083f4ab8fe6d9b57b2b0dceebffb0a9cf34b606
[libam7xxx.git] / doc / man / CMakeLists.txt
1 # add a target to generate man pages with asciidoc
2 find_package(Asciidoc)
3 if(ASCIIDOC_FOUND)
4   add_custom_target(manpages
5     ${ASCIIDOC_A2X_EXECUTABLE} -f manpage ${CMAKE_CURRENT_SOURCE_DIR}/am7xxx-play.1.txt -D ${CMAKE_CURRENT_BINARY_DIR}
6     COMMAND ${ASCIIDOC_A2X_EXECUTABLE} -f manpage ${CMAKE_CURRENT_SOURCE_DIR}/picoproj.1.txt -D ${CMAKE_CURRENT_BINARY_DIR}
7     WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
8     COMMENT "Generating man pages with Asciidoc" VERBATIM
9   )
10
11   add_custom_target(install-manpages
12     ${CMAKE_COMMAND} -E make_directory
13       "${CMAKE_INSTALL_PREFIX}/share/man/man1/"
14     COMMAND ${CMAKE_COMMAND} -E copy
15       ${DOC_OUTPUT_PATH}/man/am7xxx-play.1
16       "${CMAKE_INSTALL_PREFIX}/share/man/man1/"
17     COMMAND ${CMAKE_COMMAND} -E copy
18       ${DOC_OUTPUT_PATH}/man/picoproj.1
19       "${CMAKE_INSTALL_PREFIX}/share/man/man1/"
20   )
21   add_dependencies(install-manpages manpages)
22
23   install(CODE "execute_process(COMMAND ${CMAKE_BUILD_TOOL} install-manpages)")
24
25 endif(ASCIIDOC_FOUND)