Add interface to install EXTRA_CMAKE_FILES in other paths

If the source file sets `QT_INSTALL_PATH` property, it will install the
CMake files in the relative path starting from the config-dir in both
the build and install paths.

Change-Id: I86197d62bfac96f9c142d8abfe85c9b6f6f1a527
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit aef789ad97ee9b8f3254a0e315a0d8a4785bcbf7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 0bd6b909ab5af5b323a0ecb1a5715cea6f138191)
This commit is contained in:
Cristian Le 2025-02-18 11:52:21 +01:00 committed by Qt Cherry-pick Bot
parent 08a6fae9f9
commit 5466c4daeb

View File

@ -735,9 +735,17 @@ set(QT_ALLOW_MISSING_TOOLS_PACKAGES TRUE)")
endif()
foreach(cmake_file IN LISTS arg_EXTRA_CMAKE_FILES)
get_filename_component(basename ${cmake_file} NAME)
file(COPY ${cmake_file} DESTINATION ${config_build_dir})
list(APPEND extra_cmake_files "${config_build_dir}/${basename}")
get_source_file_property(install_path ${cmake_file} QT_INSTALL_PATH)
if(NOT install_path)
# Sanitize the install_path from `NOTFOUND` to ""
set(install_path "")
endif()
file(COPY ${cmake_file} DESTINATION "${config_build_dir}/${install_path}")
qt_install(FILES
${cmake_file}
DESTINATION "${config_install_dir}/${install_path}"
COMPONENT Devel
)
# Make sure touched extra cmake files cause a reconfigure, so they get re-copied.
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${cmake_file}")