From 9c159e6843eb7364f1e270cf62a6d0f1c86baede Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Mon, 7 Oct 2024 12:53:26 +0200 Subject: [PATCH] CMake: Improve doc file copying dependency handling in qtbase MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If doc/global/macros.qdocconf were modified, rerunning the doc generation targets in qtbase or a top-level build would use the old non-modified contents, because the file is only copied into the build dir at configure time, and there is no dependency to rerun configure. Add all the qtbase doc config files to CMAKE_CONFIGURE_DEPENDS, so that configure is reran and the files are re-copied if the files are touched. Add the QT_NO_SET_QTBASE_DOC_FILE_DEPS_COPYING variable as an opt out, in case this breaks someone's workflow in an unexpected way where they have to reconfigure too often. This is an incremental improvement over no dependencies at all. Investigating whether setting up fine-grained build-time dependencies is possible, is left for the future. Pick-to: 6.5 6.8 Change-Id: I8f0702aa789b5116ed63a3a78c5d3b19b2177131 Reviewed-by: Alexey Edelev Reviewed-by: Joerg Bornemann Reviewed-by: Topi Reiniƶ Reviewed-by: Paul Wicking Reviewed-by: Marc Mutz --- doc/CMakeLists.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 9ec6cb67994..176bbf921bb 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -10,5 +10,16 @@ foreach(dir global config) if(QT_SUPERBUILD OR "${PROJECT_NAME}" STREQUAL "QtBase") qt_path_join(destination ${QtBase_BINARY_DIR} ${INSTALL_DOCDIR}) file(COPY ${dir} DESTINATION ${destination}) + + if(NOT QT_NO_SET_QTBASE_DOC_FILE_DEPS_COPYING) + # Make sure touched doc files cause a reconfigure, so they get re-copied. + # TODO: Consider making this a build time file copy dependency. + # It is more complicated, because all documentation generation custom targets would have + # to depend on the file outputs of add_custom_command(copy), and it's not clear how the + # dependencies should be set up in that case (coarsness, use install vs build dirs, + # etc). + file(GLOB_RECURSE files LIST_DIRECTORIES FALSE "${dir}/*") + set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${files}) + endif() endif() endforeach()