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.
このコミットが含まれているのは:
Lasse Collin 2024-04-27 20:42:00 +03:00
コミット 64503cc2b7
1個のファイルの変更31行の追加9行の削除

ファイルの表示

@ -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