From: Lasse Collin Date: Sat, 27 Apr 2024 17:42:00 +0000 (+0300) Subject: CMake: Support building liblzma API docs using Doxygen X-Git-Tag: v5.7.1alpha~337 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=64503cc2b76a388ced4ec5f68234a07f0dcddcd5;p=thirdparty%2Fxz.git CMake: Support building liblzma API docs using Doxygen This is disabled by default to match the default in Autotools. Use -DUSE_DOXYGEN=ON to enable Doxygen usage. This uses the update-doxygen script, thus this is under if(UNIX) although Doxygen itself can run on Windows too. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index ac6b5803..690a3ae1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,10 +60,6 @@ # - To get translated man pages, run po4a/update-po which requires # the po4a tool. The build works without this step too. # -# - To get Doxygen-generated liblzma API docs in HTML format, -# run doxygen/update-doxygen which requires the doxygen tool. -# The build works without this step too. -# # This file provides the following installation components (if you only # need liblzma, install only its components!): # - liblzma_Runtime (shared library only) @@ -1965,12 +1961,38 @@ endif() # Documentation ############################################################################# -# Use OPTIONAL because doc/api might not exist. The liblzma API docs -# can be generated by running "doxygen/update-doxygen". -install(DIRECTORY doc/api doc/examples +if(UNIX) + option(USE_DOXYGEN "Use Doxygen to generate liblzma API docs" OFF) + + if (USE_DOXYGEN) + file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/doc") + + add_custom_command( + VERBATIM + COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/doxygen/update-doxygen" + ARGS "api" + "${CMAKE_CURRENT_SOURCE_DIR}" + "${CMAKE_CURRENT_BINARY_DIR}/doc" + OUTPUT doc/api/index.html + DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/doxygen/update-doxygen" + "${CMAKE_CURRENT_SOURCE_DIR}/doxygen/Doxyfile" + ${LIBLZMA_API_HEADERS} + ) + + add_custom_target( + liblzma-doc-api ALL + DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/doc/api/index.html" + ) + + install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/doc/api" + DESTINATION "${CMAKE_INSTALL_DOCDIR}" + COMPONENT liblzma_Documentation) + endif() +endif() + +install(DIRECTORY doc/examples DESTINATION "${CMAKE_INSTALL_DOCDIR}" - COMPONENT liblzma_Documentation - OPTIONAL) + COMPONENT liblzma_Documentation) # GPLv2 applies to the scripts. If GNU getopt_long is used then # LGPLv2.1 applies to the command line tools but, using the