From 30ba185583285cb3381b0115184ff3b553b3611e Mon Sep 17 00:00:00 2001 From: Christophe Giboudeaux Date: Sun, 9 Feb 2020 18:09:38 +0100 Subject: CMake: Allow using DESTDIR when installing documentation Previously, QtDocsHelpers.cmake was invoking CMake to copy files or directories instead of using installation targets. This resulted in DESTDIR being ignored. Now we create installation targets and ask CMake to install them. Change-Id: Idbc79d47a37f9ca865d28543bdbbdde3ba448fa3 Fixes: QTBUG-87382 Reviewed-by: Alexandru Croitor --- cmake/QtDocsHelpers.cmake | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/cmake/QtDocsHelpers.cmake b/cmake/QtDocsHelpers.cmake index 6b7a307b25..8e4bd28918 100644 --- a/cmake/QtDocsHelpers.cmake +++ b/cmake/QtDocsHelpers.cmake @@ -162,19 +162,32 @@ function(qt_internal_add_docs) add_dependencies(qch_docs qch_top_level_docs_${target}) if (QT_WILL_INSTALL) + install(DIRECTORY "${qdoc_output_dir}/" + DESTINATION "${INSTALL_DOCDIR}/${doc_target}" + COMPONENT _install_html_docs_${target} + EXCLUDE_FROM_ALL + ) + add_custom_target(install_html_docs_${target} - COMMAND ${CMAKE_COMMAND} -E copy_directory - "${qdoc_output_dir}" - "${CMAKE_INSTALL_PREFIX}/${INSTALL_DOCDIR}/${doc_target}" + COMMAND ${CMAKE_COMMAND} + --install "${CMAKE_BINARY_DIR}" + --component _install_html_docs_${target} COMMENT "Installing html docs for target ${target}" ) + install(FILES "${qch_file_path}" + DESTINATION "${INSTALL_DOCDIR}/${qch_file_name}" + COMPONENT _install_qch_docs_${target} + EXCLUDE_FROM_ALL + ) + add_custom_target(install_qch_docs_${target} - COMMAND ${CMAKE_COMMAND} -E copy_if_different - "${qch_file_path}" - "${CMAKE_INSTALL_PREFIX}/${INSTALL_DOCDIR}/${qch_file_name}" + COMMAND ${CMAKE_COMMAND} + --install "${CMAKE_BINARY_DIR}" + --component _install_qch_docs_${target} COMMENT "Installing qch docs for target ${target}" - ) + ) + else() # Don't need to do anything when not installing add_custom_target(install_html_docs_${target}) -- cgit v1.2.3