From faa26be44cd7306c8ec2276131414866d3de712d Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 7 Jan 2022 10:37:50 +0100 Subject: CMake: Fix WrapOpenSSL package Since f19ce3898e0257dac1112754b1a84c24486bda01 we link OpenSSL to QTlsBackendOpenSSLPlugin instead of QtNetwork itself. In dependent Qt repositories this leads to the following situation: QTlsBackendOpenSSLPlugin's dependencies call find_dependency(WrapOpenSSLHeaders), and OpenSSL_FOUND is set to ON in that scope. Later, we call find_package(WrapOpenSSL) in a different scope. find_package(WrapOpenSSLHeaders) bails out early, because the target WrapOpenSSLHeaders::WrapOpenSSLHeaders exists. find_package(OpenSSL) is not called again. The check for OpenSSL_FOUND fails, because the variable is not visible in the scope of FindWrapOpenSSL.cmake, and we don't create the WrapOpenSSL::WrapOpenSSL target. Fix this by checking for the existence of the target OpenSSL::SSL instead of the OpenSSL_FOUND variable. Pick-to: 6.2 6.3 Fixes: QTBUG-99623 Change-Id: Idd0e8a60fabd0c7772413d557442c0012b0b436c Reviewed-by: Alexey Edelev --- cmake/FindWrapOpenSSL.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmake/FindWrapOpenSSL.cmake') diff --git a/cmake/FindWrapOpenSSL.cmake b/cmake/FindWrapOpenSSL.cmake index 486686d338..7b6dccb1d2 100644 --- a/cmake/FindWrapOpenSSL.cmake +++ b/cmake/FindWrapOpenSSL.cmake @@ -10,7 +10,7 @@ set(WrapOpenSSL_FOUND OFF) # Reuse logic from the headers find script. find_package(WrapOpenSSLHeaders ${WrapOpenSSL_FIND_VERSION}) -if(OpenSSL_FOUND) +if(TARGET OpenSSL::SSL) if(WIN32) get_target_property(libType OpenSSL::Crypto TYPE) if(libType STREQUAL "ALIAS") -- cgit v1.2.3