From: Antonio Ospite Date: Wed, 28 Mar 2012 07:11:51 +0000 (+0200) Subject: doc: make sure docs have been generated when installing X-Git-Tag: v0.1.1~7 X-Git-Url: https://git.ao2.it/libam7xxx.git/commitdiff_plain/c4734c5b21355542c5718478f73ddf60ecf559fb?ds=sidebyside doc: make sure docs have been generated when installing This is done in three steps: - first a "custom install target" is created for each custom target which builds documentation; - then dependencies between those custom install targets and the correspondent "build" targets are added; - finally some code is added to ensure those "custom install targets" are called when the builtin install target is executed. --- diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 0569f9d..c1995f7 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -9,8 +9,14 @@ if(DOXYGEN_FOUND) COMMENT "Generating API documentation with Doxygen" VERBATIM ) - install(DIRECTORY ${DOC_OUTPUT_PATH}/html - DESTINATION "${CMAKE_INSTALL_PREFIX}/share/doc/${CMAKE_PROJECT_NAME}") + add_custom_target(install-doc + ${CMAKE_COMMAND} -E copy_directory + ${DOC_OUTPUT_PATH}/html + "${CMAKE_INSTALL_PREFIX}/share/doc/${CMAKE_PROJECT_NAME}/html" + ) + add_dependencies(install-doc doc) + + install(CODE "execute_process(COMMAND ${CMAKE_BUILD_TOOL} install-doc)") endif(DOXYGEN_FOUND) diff --git a/doc/man/CMakeLists.txt b/doc/man/CMakeLists.txt index 8029513..0083f4a 100644 --- a/doc/man/CMakeLists.txt +++ b/doc/man/CMakeLists.txt @@ -8,9 +8,18 @@ if(ASCIIDOC_FOUND) COMMENT "Generating man pages with Asciidoc" VERBATIM ) -install(FILES - ${DOC_OUTPUT_PATH}/man/am7xxx-play.1 - ${DOC_OUTPUT_PATH}/man/picoproj.1 - DESTINATION "${CMAKE_INSTALL_PREFIX}/share/man/man1/") + add_custom_target(install-manpages + ${CMAKE_COMMAND} -E make_directory + "${CMAKE_INSTALL_PREFIX}/share/man/man1/" + COMMAND ${CMAKE_COMMAND} -E copy + ${DOC_OUTPUT_PATH}/man/am7xxx-play.1 + "${CMAKE_INSTALL_PREFIX}/share/man/man1/" + COMMAND ${CMAKE_COMMAND} -E copy + ${DOC_OUTPUT_PATH}/man/picoproj.1 + "${CMAKE_INSTALL_PREFIX}/share/man/man1/" + ) + add_dependencies(install-manpages manpages) + + install(CODE "execute_process(COMMAND ${CMAKE_BUILD_TOOL} install-manpages)") endif(ASCIIDOC_FOUND)