CMake: Process extra dependencies for plugin targets as well

We started recording extra dependencies for the QtNetwork TLS plugin,
but we never actually processed them to write out the necessary
find_package calls.
This broke static builds of qtopcua, because the OpenSSL::SSL target was
no longer created in the root scope, but only in some child ones like
src/opcua, whereas the target was referenced in generator expressions
in a different sibling scope src/declarative_opcua, leading to errors like

 CMake Error at lib/cmake/Qt6/QtPrlHelpers.cmake:116
  (file): Error evaluating generator expression:
    $<TARGET_LINKER_FILE:OpenSSL::SSL>
  No target "OpenSSL::SSL"
 Call Stack (most recent call first):
  lib/cmake/Qt6/QtModuleHelpers.cmake:837 (qt_generate_prl_file)
  lib/cmake/Qt6/QtScopeFinalizerHelpers.cmake:21:EVAL:1
     (qt_finalize_module)
  src/declarative_opcua/CMakeLists.txt:DEFERRED

Make sure to process the extra deps for plugins as well.

Amends d754e43721
Amends 3c23317552

Pick-to: 6.4
Task-number: QTBUG-96283
Change-Id: I11876e0844198b3a794bc06b6691ee694fd3b1c2
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
This commit is contained in:
Alexandru Croitor 2022-07-08 11:20:18 +02:00
parent 0d1c16861a
commit 3d1464fc15

View File

@ -296,6 +296,13 @@ function(qt_internal_create_plugin_depends_file target)
unset(optional_public_depends)
set(target_deps_seen "")
# Extra 3rd party targets who's packages should be considered dependencies.
get_target_property(extra_third_party_deps "${target}" _qt_extra_third_party_dep_targets)
if(NOT extra_third_party_deps)
set(extra_third_party_deps "")
endif()
qt_collect_third_party_deps(${target})
qt_internal_remove_qt_dependency_duplicates(target_deps "${target_deps}")