From b4f19e427775311c769f3a29864f9ad72ee2d791 Mon Sep 17 00:00:00 2001 From: Leander Beernaert Date: Fri, 6 Mar 2020 09:20:41 +0100 Subject: CMake: Remove special case handling for OpenSSL Now that we can generate the library config tests which verify the OpenSSL version, we no longer need these special cases. Change-Id: I8ddccf4ae1c698db9fac391976b3b4b670712582 Reviewed-by: Alexandru Croitor --- src/CMakeLists.txt | 11 ---------- src/network/CMakeLists.txt | 13 ------------ src/network/configure.cmake | 52 +++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 50 insertions(+), 26 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 00c2f05b29..4b1c28de25 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,16 +1,5 @@ # special case skip regeneration -# Temporary fix for OpenSSL feature detection until we can provide a -# proper implementation of additional compile tests for library dependencies -# in configure.json - -find_package(OpenSSL) -if (NOT OPENSSL_FOUND OR NOT OPENSSL_VERSION VERSION_GREATER_EQUAL "1.1.0") - set(QT_FEATURE_openssl_runtime OFF CACHE BOOL "" FORCE) - set(QT_FEATURE_openssl_linked OFF CACHE BOOL "" FORCE) - set(QT_FEATURE_openssl OFF CACHE BOOL "" FORCE) -endif() - # We need to include the features of a few modules before they are actually declared. # The feature values are used as conditions for deciding whether bundled 3rd party libraries # should be built. diff --git a/src/network/CMakeLists.txt b/src/network/CMakeLists.txt index c455a00121..baea85ea99 100644 --- a/src/network/CMakeLists.txt +++ b/src/network/CMakeLists.txt @@ -1,18 +1,5 @@ # Generated from network.pro. -# special case begin -# Temporary fix for OpenSSL feature detection until we can provide a -# proper implementation of additional compile tests for library dependencies -# in configure.json - -find_package(OpenSSL) -if (NOT OPENSSL_FOUND OR NOT OPENSSL_VERSION VERSION_GREATER_EQUAL "1.1.0") - set(QT_FEATURE_openssl_runtime OFF CACHE BOOL "" FORCE) - set(QT_FEATURE_openssl_linked OFF CACHE BOOL "" FORCE) - set(QT_FEATURE_openssl OFF CACHE BOOL "" FORCE) -endif() -# special case end - ##################################################################### ## Network Module: ##################################################################### diff --git a/src/network/configure.cmake b/src/network/configure.cmake index 302a97da4f..a99323823f 100644 --- a/src/network/configure.cmake +++ b/src/network/configure.cmake @@ -8,7 +8,55 @@ qt_find_package(Libproxy PROVIDED_TARGETS PkgConfig::Libproxy) qt_find_package(OpenSSL PROVIDED_TARGETS OpenSSL::SSL) +# openssl_headers +qt_config_compile_test(openssl_headers + LIBRARIES + OpenSSL::SSL + CODE +" +#include +#include +#if !defined(OPENSSL_VERSION_NUMBER) || OPENSSL_VERSION_NUMBER-0 < 0x10100000L +# error OpenSSL >= 1.1.0 is required +#endif +#if !defined(OPENSSL_NO_EC) && !defined(SSL_CTRL_SET_CURVES) +# error OpenSSL was reported as >= 1.1.0 but is missing required features, possibly it's libressl which is unsupported +#endif +int main(int argc, char **argv) +{ + (void)argc; (void)argv; + /* BEGIN TEST: */ + + /* END TEST: */ + return 0; +} +") + qt_find_package(OpenSSL PROVIDED_TARGETS OpenSSL::SSL) +# openssl +qt_config_compile_test(openssl + LIBRARIES + OpenSSL::SSL + CODE +" +#include +#include +#if !defined(OPENSSL_VERSION_NUMBER) || OPENSSL_VERSION_NUMBER-0 < 0x10100000L +# error OpenSSL >= 1.1.0 is required +#endif +#if !defined(OPENSSL_NO_EC) && !defined(SSL_CTRL_SET_CURVES) +# error OpenSSL was reported as >= 1.1.0 but is missing required features, possibly it's libressl which is unsupported +#endif +int main(int argc, char **argv) +{ + (void)argc; (void)argv; + /* BEGIN TEST: */ +SSL_free(SSL_new(0)); + /* END TEST: */ + return 0; +} +") + qt_find_package(GSSAPI PROVIDED_TARGETS GSSAPI::GSSAPI) @@ -217,14 +265,14 @@ qt_feature_definition("openssl" "QT_NO_OPENSSL" NEGATE) qt_feature_config("openssl" QMAKE_PUBLIC_QT_CONFIG) qt_feature("openssl-runtime" AUTODETECT NOT WINRT AND NOT WASM - CONDITION NOT QT_FEATURE_securetransport AND NOT QT_FEATURE_schannel AND OPENSSL_INCLUDE_DIR + CONDITION NOT QT_FEATURE_securetransport AND NOT QT_FEATURE_schannel AND TEST_openssl_headers ENABLE INPUT_openssl STREQUAL 'yes' OR INPUT_openssl STREQUAL 'runtime' DISABLE INPUT_openssl STREQUAL 'no' OR INPUT_openssl STREQUAL 'linked' OR INPUT_ssl STREQUAL 'no' ) qt_feature("openssl-linked" PRIVATE LABEL " Qt directly linked to OpenSSL" AUTODETECT OFF - CONDITION NOT QT_FEATURE_securetransport AND NOT QT_FEATURE_schannel AND OpenSSL_FOUND + CONDITION NOT QT_FEATURE_securetransport AND NOT QT_FEATURE_schannel AND TEST_openssl ENABLE INPUT_openssl STREQUAL 'linked' ) qt_feature_definition("openssl-linked" "QT_LINKED_OPENSSL") -- cgit v1.2.3