Fix handling of _nolink targets for the QtNetwork module
When a _nolink target is exported, instead of getting the original namespace prefix, it gets the Qt6 prefix (OpenSSL::OpenSSL_nolink -> Qt6::OpenSSL_nolink). There is some special case code in Network autotests which tries to access the former target name, which doesn't exist when building standalone tests. Make sure to create a Qt6:: library alias for _nolink targets during a build (so before the library is exported), and change the Network autotests project to use this Qt6:: namespaced library, which will ensure it is found both in a standalone tests build and in a regular Qt build. Also make sure to actually call find_package to find the OpenSSL library when building standalone tests, otherwise configuration will fail. Change-Id: I3da5b958e72e745a50380f8ab1644459a7c6b005 Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
parent
3cfaa19c60
commit
c51fe841f4
@ -685,8 +685,11 @@ function(qt_create_nolink_target target dependee_target)
|
||||
# Create the nolink interface target, assign the properties from the original target,
|
||||
# associate the nolink target with the same export which contains
|
||||
# the target that uses the _nolink target.
|
||||
# Also create a namespaced alias of the form {$target}::${target}_nolink which is used by
|
||||
# Also create a namespaced alias of the form ${target}::${target}_nolink which is used by
|
||||
# our modules.
|
||||
# Also create a Qt namespaced alias target, because when exporting via install(EXPORT)
|
||||
# Vulkan::Vulkan_nolink transforms into Qt6::Vulkan_nolink, and the latter needs to be an
|
||||
# accessible alias for standalone tests.
|
||||
if(NOT TARGET "${nolink_target}")
|
||||
add_library("${nolink_target}" INTERFACE)
|
||||
set(prefixed_nolink_target "${target}_nolink")
|
||||
@ -703,6 +706,7 @@ function(qt_create_nolink_target target dependee_target)
|
||||
$<TARGET_PROPERTY:${target},INTERFACE_COMPILE_FEATURES>)
|
||||
|
||||
add_library(${prefixed_nolink_target} ALIAS ${nolink_target})
|
||||
add_library("${INSTALL_CMAKE_NAMESPACE}::${nolink_target}" ALIAS ${nolink_target})
|
||||
|
||||
set(export_name "${INSTALL_CMAKE_NAMESPACE}${dependee_target}Targets")
|
||||
qt_install(TARGETS ${nolink_target} EXPORT ${export_name})
|
||||
|
@ -14,6 +14,7 @@ if(NOT TARGET Qt::Test)
|
||||
qt_find_package(WrapDBus1 PROVIDED_TARGETS dbus-1)
|
||||
qt_find_package(ICU COMPONENTS i18n uc data PROVIDED_TARGETS ICU::i18n ICU::uc ICU::data)
|
||||
qt_find_package(Threads PROVIDED_TARGETS Threads::Threads)
|
||||
qt_find_package(OpenSSL PROVIDED_TARGETS OpenSSL::OpenSSL)
|
||||
endif()
|
||||
# special case end
|
||||
|
||||
|
@ -9,7 +9,7 @@ if (QT_FEATURE_private_tests)
|
||||
endif()
|
||||
|
||||
if (QT_FEATURE_openssl AND QT_FEATURE_ssl AND NOT QT_FEATURE_openssl_linked)
|
||||
include_directories($<TARGET_PROPERTY:OpenSSL::SSL_nolink,INTERFACE_INCLUDE_DIRECTORIES>)
|
||||
include_directories($<TARGET_PROPERTY:${INSTALL_CMAKE_NAMESPACE}::SSL_nolink,INTERFACE_INCLUDE_DIRECTORIES>)
|
||||
endif()
|
||||
endif()
|
||||
# special case end
|
||||
|
Loading…
Reference in New Issue
Block a user