summaryrefslogtreecommitdiffstats
path: root/src/network/configure.cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2020-04-07 17:54:49 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2020-04-08 22:03:24 +0200
commite0346df1b21cb30b54ae8d4918addc9925fa8479 (patch)
treed45cfc3bc6a3d59507bc26f963d9eee57531b6b5 /src/network/configure.cmake
parent0a13c3a3f0ef1eb7274badac000db9ec584faeca (diff)
CMake: Handle finding of OpenSSL headers correctly
In Coin when provisioning for Android, we download and configure the OpenSSL package, but don't actually build it. This means that find_package(OpenSSL) can find the headers, but not the library, and thus the package is marked as not found. Previously the openssl_headers feature used the result of finding the OpenSSL package, which led to it being disabled in the above described Android case. Introduce 2 new find scripts FindWrapOpenSSL and FindWrapOpenSSLHeaders. FindWrapOpenSSLHeaders wraps FindOpenSSL, and checks if the headers were found, regardless of the OpenSSL_FOUND value, which can be used for implementing the openssl_headers feature. FindWrapOpenSSL uses FindWrapOpenSSLHeaders, and simply wraps the OpenSSL target if available. The find scripts also have to set CMAKE_FIND_ROOT_PATH for Android. Otherwise when someone passes in an OPENSSL_ROOT_DIR, its value will always be prepended to the Android sysroot, causing the package not to be found. Adjust the mapping in helper.py to use the targets created by these find scripts. This also replaces the openssl/nolink target. Adjust the projects and tests to use the new target names. Adjust the compile tests for dtls and oscp to use the WrapOpenSSLHeaders target, so that the features can be enabled even if the library is dlopen-ed (like on Android). Task-number: QTBUG-83371 Change-Id: I738600e5aafef47a57e1db070be40116ca8ab995 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src/network/configure.cmake')
-rw-r--r--src/network/configure.cmake12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/network/configure.cmake b/src/network/configure.cmake
index cea673e943..ae9deb79ed 100644
--- a/src/network/configure.cmake
+++ b/src/network/configure.cmake
@@ -7,11 +7,11 @@
#### Libraries
qt_find_package(Libproxy PROVIDED_TARGETS PkgConfig::Libproxy)
-qt_find_package(OpenSSL PROVIDED_TARGETS OpenSSL::SSL)
+qt_find_package(WrapOpenSSLHeaders PROVIDED_TARGETS WrapOpenSSLHeaders::WrapOpenSSLHeaders)
# openssl_headers
qt_config_compile_test(openssl_headers
LIBRARIES
- OpenSSL::SSL
+ WrapOpenSSLHeaders::WrapOpenSSLHeaders
CODE
"
#include <openssl/ssl.h>
@@ -32,11 +32,11 @@ int main(int argc, char **argv)
}
")
-qt_find_package(OpenSSL PROVIDED_TARGETS OpenSSL::SSL)
+qt_find_package(WrapOpenSSL PROVIDED_TARGETS WrapOpenSSL::WrapOpenSSL)
# openssl
qt_config_compile_test(openssl
LIBRARIES
- OpenSSL::SSL
+ WrapOpenSSL::WrapOpenSSL
CODE
"
#include <openssl/ssl.h>
@@ -164,7 +164,7 @@ socklen_t sctpInitMsgSize = sizeof(sctpInitMsg);
qt_config_compile_test(dtls
LABEL "DTLS support in OpenSSL"
LIBRARIES
- OpenSSL::SSL
+ WrapOpenSSLHeaders::WrapOpenSSLHeaders
CODE
"
#include <openssl/ssl.h>
@@ -185,7 +185,7 @@ int main(int argc, char **argv)
qt_config_compile_test(ocsp
LABEL "OCSP stapling support in OpenSSL"
LIBRARIES
- OpenSSL::SSL
+ WrapOpenSSLHeaders::WrapOpenSSLHeaders
CODE
"
#include <openssl/ssl.h>