c7ce4bb9d96c6bea27a2abc536c84522ba93d6a0
[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 ${DOC_OUTPUT_PATH}/man
6     COMMAND ${ASCIIDOC_A2X_EXECUTABLE} -f manpage ${CMAKE_CURRENT_SOURCE_DIR}/am7xxx-modeswitch.1.txt -D ${DOC_OUTPUT_PATH}/man
7     COMMAND ${ASCIIDOC_A2X_EXECUTABLE} -f manpage ${CMAKE_CURRENT_SOURCE_DIR}/picoproj.1.txt -D ${DOC_OUTPUT_PATH}/man
8     WORKING_DIRECTORY ${DOC_OUTPUT_PATH}/man
9     COMMENT "Generating man pages with Asciidoc" VERBATIM
10   )
11
12   add_custom_target(install-manpages
13     COMMAND ${CMAKE_COMMAND} -DCOMPONENT=manpages -P ${CMAKE_BINARY_DIR}/cmake_install.cmake
14     COMMENT "Installing manpages")
15   add_dependencies(install-manpages manpages)
16
17   install(CODE "execute_process(COMMAND ${CMAKE_BUILD_TOOL} manpages)")
18
19   install(FILES
20     ${DOC_OUTPUT_PATH}/man/am7xxx-play.1
21     ${DOC_OUTPUT_PATH}/man/am7xxx-modeswitch.1
22     ${DOC_OUTPUT_PATH}/man/picoproj.1
23     DESTINATION "${CMAKE_INSTALL_PREFIX}/share/man/man1/"
24     COMPONENT manpages)
25
26 endif(ASCIIDOC_FOUND)