# - 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)
# 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