Avoid requiring all Qt targets defined for user projects

When building user projects replace the FATAL_ERROR about the missing
Qt targets with the WARNING and mention that the linking might be
incomplete. The updated check affected some user projects that used
the linking to the versioned targets and our deferred finalizers. If
Qt targets are not propagated to the global scope or not found in the
top-level directories, finalizers might fail to resolve these targets.
Now users will see the warning. The side effect of the missing targets -
missing plugin linking, or incomplete deployment, both use walk libs
results.

Pick-to: 6.7 6.5
Change-Id: I5c68b548122775424909c62f904f887417816fbc
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit b5fa9085146043c9d34025e273b5c9b9918d3db4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Alexey Edelev 2024-07-02 18:50:46 +02:00 committed by Qt Cherry-pick Bot
parent 4a087d3e45
commit d4a70a1048

View File

@ -256,8 +256,15 @@ function(__qt_internal_walk_libs
endif() endif()
endif() endif()
elseif("${lib_target}" MATCHES "^(Qt|${QT_CMAKE_EXPORT_NAMESPACE})::(.*)") elseif("${lib_target}" MATCHES "^(Qt|${QT_CMAKE_EXPORT_NAMESPACE})::(.*)")
message(FATAL_ERROR "The ${CMAKE_MATCH_2} target is mentioned as a dependency for \ if(QT_BUILDING_QT OR QT_BUILD_STANDALONE_TESTS)
${target}, but not declared.") set(message_type FATAL_ERROR)
set(message_addition "")
else()
set(message_type WARNING)
set(message_addition " The linking might be incomplete.")
endif()
message(${message_type} "The ${CMAKE_MATCH_2} target is mentioned as a dependency"
" for ${target}, but not declared.${message_addition}")
else() else()
if(NOT operation MATCHES "^(collect|direct)_targets$") if(NOT operation MATCHES "^(collect|direct)_targets$")
set(final_lib_name_to_merge "${lib_target}") set(final_lib_name_to_merge "${lib_target}")