From f16c8fdf18ea296e9ebffe31a71e564fe841046c Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Tue, 14 Sep 2021 17:45:22 +0200 Subject: Add explicit install rules for the autogenerated cpp exports If qt_internal_generate_cpp_global_exports is called outside the qt_internall_add_module function scope, install rule that is generated by qt_internall_add_module won't include generated cpp export header files. This adds the explicit file-based install rule for the generated cpp exports. Since qt_internal_generate_cpp_global_exports now encapsulates all install rules related to the generated cpp exports, no need to expose the generated filenames outside the function. It's expected that module public headers now could be added outside the qt_internal_add_module function. Tune generating of the module timestamp by replacing the DEPENDS value with generator expression. Task-number: QTBUG-90492 Change-Id: I0f086abc8187c5d51117c3a75c47b58580f6913f Reviewed-by: Alexandru Croitor --- cmake/QtModuleHelpers.cmake | 46 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 8 deletions(-) (limited to 'cmake') diff --git a/cmake/QtModuleHelpers.cmake b/cmake/QtModuleHelpers.cmake index d223f954e5..502af4f05e 100644 --- a/cmake/QtModuleHelpers.cmake +++ b/cmake/QtModuleHelpers.cmake @@ -308,6 +308,10 @@ function(qt_internal_add_module target) ### FIXME: Can we replace headers.pri? qt_read_headers_pri("${module_build_interface_include_dir}" "module_headers") + + set_property(TARGET ${target} APPEND PROPERTY + _qt_module_timestamp_dependencies "${module_headers_public}") + if(arg_GENERATE_CPP_EXPORTS) if(arg_CPP_EXPORT_HEADER_BASE_NAME) set(cpp_export_header_base_name @@ -318,13 +322,9 @@ function(qt_internal_add_module target) set(generate_private_cpp_export "GENERATE_PRIVATE_CPP_EXPORTS") endif() qt_internal_generate_cpp_global_exports(${target} ${module_define_infix} - generated_public_cpp_export - generated_private_cpp_export "${cpp_export_header_base_name}" "${generate_private_cpp_export}" ) - list(APPEND module_headers_public "${generated_public_cpp_export}") - list(APPEND module_headers_private "${generated_private_cpp_export}") endif() set(module_depends_header @@ -460,7 +460,7 @@ function(qt_internal_add_module target) set(timestamp_file "${CMAKE_CURRENT_BINARY_DIR}/timestamp") add_custom_command(OUTPUT "${timestamp_file}" COMMAND ${CMAKE_COMMAND} -E touch "${timestamp_file}" - DEPENDS ${module_headers_public} + DEPENDS "$" VERBATIM) add_custom_target(${target}_timestamp ALL DEPENDS "${timestamp_file}") endif() @@ -933,9 +933,7 @@ function(qt_describe_module target) qt_install(FILES "${descfile_out}" DESTINATION "${install_dir}") endfunction() -function(qt_internal_generate_cpp_global_exports target module_define_infix - out_public_header out_private_header) - +function(qt_internal_generate_cpp_global_exports target module_define_infix) cmake_parse_arguments(arg "GENERATE_PRIVATE_CPP_EXPORTS" "CPP_EXPORT_HEADER_BASE_NAME" @@ -974,4 +972,36 @@ function(qt_internal_generate_cpp_global_exports target module_define_infix set(${out_private_header} "${generated_private_header_path}" PARENT_SCOPE) target_sources(${target} PRIVATE "${generated_private_header_path}") endif() + + get_target_property(is_framework ${target} FRAMEWORK) + + get_target_property(target_type ${target} TYPE) + set(is_interface_lib 0) + if(target_type STREQUAL "INTERFACE_LIBRARY") + set(is_interface_lib 1) + endif() + + set_property(TARGET ${target} APPEND PROPERTY + _qt_module_timestamp_dependencies "${generated_header_path}") + + if(is_framework) + if(NOT is_interface_lib) + qt_copy_framework_headers(${target} PUBLIC "${generated_header_path}") + + if(arg_GENERATE_PRIVATE_CPP_EXPORTS) + qt_copy_framework_headers(${target} PRIVATE "${generated_private_header_path}") + endif() + endif() + else() + set_property(TARGET ${target} APPEND PROPERTY PUBLIC_HEADER "${generated_header_path}") + qt_install(FILES "${generated_header_path}" + DESTINATION "${module_install_interface_include_dir}") + + if(arg_GENERATE_PRIVATE_CPP_EXPORTS) + set_property(TARGET ${target} APPEND PROPERTY PRIVATE_HEADER + "${generated_private_header_path}") + qt_install(FILES "${generated_private_header_path}" + DESTINATION "${module_install_interface_private_include_dir}") + endif() + endif() endfunction() -- cgit v1.2.3