From d4a70a1048d068965167f8287b30b45b5ca9586e Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Tue, 2 Jul 2024 18:50:46 +0200 Subject: [PATCH] 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 (cherry picked from commit b5fa9085146043c9d34025e273b5c9b9918d3db4) Reviewed-by: Qt Cherry-pick Bot --- cmake/QtPublicWalkLibsHelpers.cmake | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cmake/QtPublicWalkLibsHelpers.cmake b/cmake/QtPublicWalkLibsHelpers.cmake index 959283aca16..7651d13690a 100644 --- a/cmake/QtPublicWalkLibsHelpers.cmake +++ b/cmake/QtPublicWalkLibsHelpers.cmake @@ -256,8 +256,15 @@ function(__qt_internal_walk_libs endif() endif() elseif("${lib_target}" MATCHES "^(Qt|${QT_CMAKE_EXPORT_NAMESPACE})::(.*)") - message(FATAL_ERROR "The ${CMAKE_MATCH_2} target is mentioned as a dependency for \ -${target}, but not declared.") + if(QT_BUILDING_QT OR QT_BUILD_STANDALONE_TESTS) + 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() if(NOT operation MATCHES "^(collect|direct)_targets$") set(final_lib_name_to_merge "${lib_target}")