From aef789ad97ee9b8f3254a0e315a0d8a4785bcbf7 Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Tue, 18 Feb 2025 11:52:21 +0100 Subject: [PATCH] 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 --- cmake/QtModuleHelpers.cmake | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/cmake/QtModuleHelpers.cmake b/cmake/QtModuleHelpers.cmake index 485d510b98e..98ebdaed137 100644 --- a/cmake/QtModuleHelpers.cmake +++ b/cmake/QtModuleHelpers.cmake @@ -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}")