summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorAlexey Edelev <alexey.edelev@qt.io>2021-09-14 17:45:22 +0200
committerAlexey Edelev <alexey.edelev@qt.io>2021-09-17 13:57:17 +0200
commitf16c8fdf18ea296e9ebffe31a71e564fe841046c (patch)
tree38c10e6ddbaf6529cffdd2e76bd8a957bf33cfd6 /cmake
parentbb4b40b7e1b7cc0af2f0c74a991edf39d64cac06 (diff)
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 <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtModuleHelpers.cmake46
1 files changed, 38 insertions, 8 deletions
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 "$<TARGET_PROPERTY:${target},_qt_module_timestamp_dependencies>"
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()