Collect module_sync_headers targets from the target deps

Use the internal target property to store the module_sync_header target
name. The property then is used to collect module_sync_header targets
and build the dependency tree between them. This mechanism only works
for Qt dependencies that are added using qt_internal_extend_target call
that works well at least for out CI builds. The mechanism allows to
omit the race in sync_header runs that might lead to unexpected results
since internal targets like automoc or headersclean_check only depend
directly on module_sync_header target that belong to the module.

Change-Id: I564f3ea0f3c1703e70c4c300fd1307c3214d39d8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Alexey Edelev 2023-05-25 19:32:12 +02:00
parent 251e3b44fa
commit 0006a564c8
2 changed files with 12 additions and 0 deletions

View File

@ -171,6 +171,7 @@ function(qt_internal_target_sync_headers target module_headers module_headers_ge
${syncqt_args_rsp}
${module_headers}
${QT_CMAKE_EXPORT_NAMESPACE}::syncqt
"$<GENEX_EVAL:$<TARGET_PROPERTY:${target},_qt_internal_sync_headers_deps>>"
COMMENT
"Running syncqt.cpp for module: ${module}"
VERBATIM
@ -180,6 +181,8 @@ function(qt_internal_target_sync_headers target module_headers module_headers_ge
${syncqt_outputs}
)
add_dependencies(sync_headers ${target}_sync_headers)
set_target_properties(${target}
PROPERTIES _qt_internal_sync_headers_target ${target}_sync_headers)
# This target is required when building docs, to make all header files and their aliases
# available for qdoc.

View File

@ -114,6 +114,15 @@ function(qt_internal_extend_target target)
if(NOT base_lib STREQUAL lib)
qt_create_nolink_target("${base_lib}" ${target})
endif()
# Collect _sync_headers targets from libraries that the target depends on. This is
# heuristic way of building the dependency tree between the _sync_headers targets of
# different Qt modules.
if(TARGET "${lib}")
set(out_genex "$<TARGET_PROPERTY:${lib},_qt_internal_sync_headers_target>")
set_property(TARGET ${target}
APPEND PROPERTY _qt_internal_sync_headers_deps "${out_genex}")
endif()
endforeach()
# Set-up the target