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.

Pick-to: 6.8 6.9
Change-Id: I86197d62bfac96f9c142d8abfe85c9b6f6f1a527
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Cristian Le 2025-02-18 11:52:21 +01:00
parent f8d1b58427
commit aef789ad97

View File

@ -751,9 +751,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}")