From 686cfaf162d17bdc3a915c67ed9d1fdc091c2a7e Mon Sep 17 00:00:00 2001 From: Ivan Komissarov Date: Sun, 14 Aug 2022 11:46:43 +0300 Subject: cmake: fix installing documentation The HTML documentation was not installed if QCH doc was not requested, fix that. Introduce a new 'qbs_docs' target which should be used instead of the 'BuildQbsDocumentation' target. This is done for compatibility with QMake. Also, introduce a single 'qbs_docs' component for installing docs in one go - this is required for MacPorts since there is no easy way to install multiple components at once with CMake. Which docs will be installed is controlled at the configure step: $ cmake -DQBS_INSTALL_HTML_DOCS=1 -DQBS_INSTALL_QCH_DOCS=1 -DQBS_INSTALL_MAN_PAGE=1 $ cmake --build . --target qbs_docs # not required for man-page only install $ cmake --install . --component qbs_docs Change-Id: I174662c54255a8fb10529b1961c298eb1f1b1470 Reviewed-by: Christian Kandeler --- cmake/QbsDocumentation.cmake | 17 ++++++++++++++--- doc/man/CMakeLists.txt | 2 +- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/cmake/QbsDocumentation.cmake b/cmake/QbsDocumentation.cmake index cc6752b37..7f5ff048f 100644 --- a/cmake/QbsDocumentation.cmake +++ b/cmake/QbsDocumentation.cmake @@ -70,6 +70,11 @@ function(_qbs_setup_doc_targets) BuildQbsDocumentation ALL COMMENT "Build Qbs documentation") add_dependencies(BuildQbsDocumentation qbs_html_docs qbs_qch_docs) endif() + if (NOT TARGET qbs_docs) + add_custom_target( + qbs_docs ALL COMMENT "Build Qbs documentation") + add_dependencies(qbs_docs BuildQbsDocumentation) + endif() endfunction() function(_find_python_module module) @@ -184,6 +189,13 @@ function(_qbs_setup_qdoc_targets _qdocconf_file _retval) add_custom_target(${_html_target} DEPENDS "${_fixed_html_artifact}") add_dependencies(qbs_html_docs "${_html_target}") + # artifacts might be required for QCH-only installation, so we build them + # always, and skip HTML docs installation here + if (QBS_INSTALL_HTML_DOCS) + install(DIRECTORY "${_html_outputdir}" DESTINATION "${_arg_INSTALL_DIR}" + COMPONENT qbs_docs) + endif() + set("${_retval}" "${_html_outputdir}" PARENT_SCOPE) endfunction() @@ -229,9 +241,7 @@ function(_qbs_setup_qhelpgenerator_targets _qdocconf_file _html_outputdir) add_dependencies(qbs_qch_docs "${_qch_target}") install(FILES "${_qch_outputdir}/${_target}.qch" DESTINATION "${_arg_INSTALL_DIR}" - COMPONENT qbs_qch_docs) - install(DIRECTORY "${_qch_outputdir}/html" DESTINATION "${_arg_INSTALL_DIR}" - COMPONENT qbs_html_docs) + COMPONENT qbs_docs) endfunction() # Helper functions: @@ -286,6 +296,7 @@ function(add_qbs_documentation qdocconf_file) set(SRCDIR "${Qbs_SOURCE_DIR}/doc") set(_qch_params) + # if QBS_INSTALL_QCH_DOCS is No, qch generation will be skipped entirely if (QBS_INSTALL_QCH_DOCS) set(_qch_params QCH QCH_DIR "${CMAKE_CURRENT_BINARY_DIR}") endif() diff --git a/doc/man/CMakeLists.txt b/doc/man/CMakeLists.txt index b9ef2020a..00d003d7f 100644 --- a/doc/man/CMakeLists.txt +++ b/doc/man/CMakeLists.txt @@ -1,3 +1,3 @@ if (QBS_INSTALL_MAN_PAGE) - install(FILES qbs.1 DESTINATION ${QBS_RESOURCES_INSTALL_DIR}/man/man1 COMPONENT qbs_man_page) + install(FILES qbs.1 DESTINATION ${QBS_RESOURCES_INSTALL_DIR}/man/man1 COMPONENT qbs_docs) endif() -- cgit v1.2.3