qtbase/doc/CMakeLists.txt
Alexandru Croitor 9c159e6843 CMake: Improve doc file copying dependency handling in qtbase
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 <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2024-10-14 21:59:07 +02:00

26 lines
1.2 KiB
CMake

# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
#
# Copy/Install doc configuration files to the build/install directory
#
qt_path_join(doc_install_dir ${QT_INSTALL_DIR} ${INSTALL_DOCDIR})
foreach(dir global config)
qt_copy_or_install(DIRECTORY ${dir} DESTINATION ${doc_install_dir})
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()