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 <alexandru.croitor@qt.io>
bb10
Christophe Giboudeaux 2020-02-09 18:09:38 +01:00
parent 9fa071d3fe
commit 30ba185583
1 changed files with 20 additions and 7 deletions

View File

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