X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=docs%2FCMakeLists.txt;h=8671079358419e69ce58c1e65c10abd06f221df4;hb=refs%2Fheads%2Fv1.x;hp=784fadb71b09332e77f53bdeb87eb336a33f42b0;hpb=c3526f7547e7a69204a25982f6764afdab663252;p=awesomized%2Flibmemcached diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index 784fadb7..86710793 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -2,7 +2,7 @@ find_package(Sphinx) if(NOT SPHINX_EXECUTABLE) - message(WARNING "The sphinx-build command is required to build manpages.") + message(WARNING "The sphinx-build command is required to build documentation.") else() @@ -29,35 +29,53 @@ else() # MAN output directory set(SPHINX_MAN_DIR "${SPHINX_BUILD_DIR}/man") - configure_file( - "${SPHINX_SOURCE_DIR}/conf.py.in" - "${SPHINX_BUILD_DIR}/conf.py" - @ONLY) + configure_file("conf.py.in" "conf.py" @ONLY) + add_subdirectory(source) + + file(GLOB_RECURSE DOCS_SOURCE + CONFIGURE_DEPENDS + "*.rst") if(BUILD_DOCS_HTML) - add_custom_target(html - ${SPHINX_EXECUTABLE} - -q -b html - -c "${SPHINX_BUILD_DIR}" - -d "${SPHINX_CACHE_DIR}" - ${SPHINX_OPTIONS} - "${SPHINX_SOURCE_DIR}" - "${SPHINX_HTML_DIR}" + add_custom_command( + OUTPUT "${SPHINX_HTML_DIR}" + COMMAND + ${SPHINX_EXECUTABLE} + -q -b html + -c "${SPHINX_BUILD_DIR}" + -d "${SPHINX_CACHE_DIR}" + ${SPHINX_OPTIONS} + "${SPHINX_SOURCE_DIR}" + "${SPHINX_HTML_DIR}" + COMMAND + ${CMAKE_COMMAND} -E touch "${SPHINX_HTML_DIR}" BYPRODUCTS ${SPHINX_HTML_DIR} + DEPENDS "${DOCS_SOURCE}" conf.py.in ) + add_custom_target(html ALL DEPENDS "${SPHINX_HTML_DIR}") + + install(DIRECTORY ${SPHINX_HTML_DIR}/ + COMPONENT doc + DESTINATION ${CMAKE_INSTALL_DOCDIR}/html) endif() if(BUILD_DOCS_MAN) - add_custom_target(man ALL - ${SPHINX_EXECUTABLE} - -q -b man - -c "${SPHINX_BUILD_DIR}" - -d "${SPHINX_CACHE_DIR}" - ${SPHINX_OPTIONS} - "${SPHINX_SOURCE_DIR}" - "${SPHINX_MAN_DIR}" + add_custom_command( + OUTPUT ${SPHINX_MAN_DIR} + COMMAND + ${SPHINX_EXECUTABLE} + -q -b man + -c "${SPHINX_BUILD_DIR}" + -d "${SPHINX_CACHE_DIR}" + ${SPHINX_OPTIONS} + "${SPHINX_SOURCE_DIR}" + "${SPHINX_MAN_DIR}" + COMMAND + ${CMAKE_COMMAND} -E touch "${SPHINX_MAN_DIR}" BYPRODUCTS ${SPHINX_MAN_DIR} + DEPENDS "${DOCS_SOURCE}" conf.py.in ) + add_custom_target(man ALL DEPENDS "${SPHINX_MAN_DIR}") set(MAN_EXT "") if(BUILD_DOCS_MANGZ) @@ -70,17 +88,21 @@ else() if(GZIP) set(MAN_EXT ".gz") add_custom_target(man_gz ALL - ${GZIP} -kf ${SPHINX_MAN_DIR}/*.{1,3} - DEPENDS man - ) + COMMAND ${GZIP} -kf + ${SPHINX_MAN_DIR}/*.1 + ${SPHINX_MAN_DIR}/*.3 + DEPENDS ${SPHINX_MAN_DIR} + ) # some shells do not support braced glob patterns endif() endif() install(DIRECTORY ${SPHINX_MAN_DIR}/ + COMPONENT doc DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 FILES_MATCHING PATTERN *.1${MAN_EXT} ) install(DIRECTORY ${SPHINX_MAN_DIR}/ + COMPONENT doc DESTINATION ${CMAKE_INSTALL_MANDIR}/man3 FILES_MATCHING PATTERN *.3${MAN_EXT} )