summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorAlexey Edelev <alexey.edelev@qt.io>2024-02-13 13:33:46 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2024-02-14 20:22:49 +0000
commit347f94a8dd13d9a2c15c2ea05a0c29ee52022240 (patch)
tree18cc6eddf5f1b3ef102441b4712c3d530c9df5f3 /cmake
parent86f439e632d583867c4e55d3ceeb31c020f8806c (diff)
Change the mechanism that copies framework header files
Split the header copy custom commands into two blocks and add <module>_sync_headers_fw_copy target that is responsible for the copy of CaMeL-case header aliases. For the Ninja generator we leave the file-level dependencies between the <module>_sync_headers_fw_copy target and header copy commands. For the Unix Makefiles generator we put the command directly to the target to make sure it's executed by make. Also add the explicit commands for creating the output header directories. Fixes: QTBUG-122200 Pick-to: 6.5 Change-Id: I71ba716d17a879f20ae0869cf2257d246ac17eff Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 103eca1070a75bfa97d0b72b94e0c759ef0bcd1c) (cherry picked from commit f6c2e909c9e34314342426a71bd4d3a123dcd35c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtFrameworkHelpers.cmake47
1 files changed, 35 insertions, 12 deletions
diff --git a/cmake/QtFrameworkHelpers.cmake b/cmake/QtFrameworkHelpers.cmake
index 8c39cb9b8f..f22dec1182 100644
--- a/cmake/QtFrameworkHelpers.cmake
+++ b/cmake/QtFrameworkHelpers.cmake
@@ -86,10 +86,12 @@ function(qt_copy_framework_headers target)
set(out_files "")
set(in_files "")
+ set(out_dirs "")
set(copy_commands "")
foreach(type IN ITEMS PUBLIC PRIVATE QPA RHI)
set(in_files_${type} "")
set(fw_output_header_dir "${output_dir_${type}}")
+ list(APPEND out_dirs "${fw_output_header_dir}")
foreach(hdr IN LISTS arg_${type})
get_filename_component(in_file_path ${hdr} ABSOLUTE)
get_filename_component(in_file_name ${hdr} NAME)
@@ -106,19 +108,40 @@ function(qt_copy_framework_headers target)
list(REMOVE_DUPLICATES out_files)
list(REMOVE_DUPLICATES in_files)
- add_custom_command(
- OUTPUT "${output_dir}/${fw_versioned_header_dir}" ${out_files}
- DEPENDS ${in_files} ${target}_sync_headers
- COMMAND
- ${CMAKE_COMMAND} -E copy_directory
- "${module_build_interface_include_dir}/.syncqt_staging"
- "${output_dir}/${fw_versioned_header_dir}"
- ${copy_commands}
- VERBATIM
- COMMENT "Copy the ${target} header files to the framework directory"
+
+ set(copy_fw_sync_headers_command
+ "${CMAKE_COMMAND}" -E copy_directory
+ "${module_build_interface_include_dir}/.syncqt_staging"
+ "${output_dir}/${fw_versioned_header_dir}"
)
- set_property(TARGET ${target} APPEND PROPERTY
- QT_COPIED_FRAMEWORK_HEADERS "${out_files}")
+
+ if(CMAKE_GENERATOR MATCHES "^Ninja")
+ add_custom_command(
+ OUTPUT "${output_dir}/${fw_versioned_header_dir}"
+ DEPENDS ${target}_sync_headers
+ COMMAND ${copy_fw_sync_headers_command}
+ VERBATIM
+ )
+ add_custom_target(${target}_copy_fw_sync_headers
+ DEPENDS "${output_dir}/${fw_versioned_header_dir}")
+ else()
+ add_custom_target(${target}_copy_fw_sync_headers
+ COMMAND ${copy_fw_sync_headers_command})
+ endif()
+
+ if(out_files)
+ add_custom_command(
+ OUTPUT ${out_files}
+ DEPENDS ${target}_copy_fw_sync_headers ${in_files}
+ COMMAND
+ ${CMAKE_COMMAND} -E make_directory ${out_dirs}
+ ${copy_commands}
+ VERBATIM
+ COMMENT "Copy the ${target} header files to the framework directory"
+ )
+ set_property(TARGET ${target} APPEND PROPERTY
+ QT_COPIED_FRAMEWORK_HEADERS "${out_files}")
+ endif()
endfunction()
function(qt_internal_generate_fake_framework_header target)