Commit Graph

6 Commits

Author SHA1 Message Date
Joerg Bornemann
faa26be44c CMake: Fix WrapOpenSSL package
Since f19ce3898e 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 <alexey.edelev@qt.io>
2022-01-07 11:16:21 +01:00
Alexandru Croitor
6d59e1e088 CMake: Be more explicit about found OpenSSL variables
Specifying the variables as required variable will show the found
paths in the configure output.

Pick-to: 6.2
Task-number: QTBUG-94355
Change-Id: I985a3585f37b38e25b6be4fae5d42c82e06517de
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-07-01 18:57:22 +02:00
Martin Storsjö
236ae73ed8 Lowercase system includes and lib names for Windows, fix cross compiling
When cross compiling from a case sensitive file system, casing
matters, and mingw headers and import libraries consistently
use lowercase.

This was uncovered by d385158d5213ef568b7629e2aa4a818016bbffac;
prior to that, the schannel TLS plugin didn't end up built (at
least when cross compiling).

Fix other similar cases that can be found by grepping the repo.

Change-Id: Ia696e17b7aaa979d7b7f5b0801383f338a8b585b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-04-23 14:31:04 +03:00
Joerg Bornemann
b6b9e54f16 Fix FindWrapOpenSSL.cmake if OpenSSL::Crypto is UNKNOWN_LIBRARY
The attempt to call target_link_libraries on OpenSSL::Crypto failed when
this target was added as UNKNOWN library by FindOpenSSL.cmake.
Instead, set the INTERFACE_LINK_LIBRARIES property directly.

Pick-to: 6.1 6.0
Fixes: QTBUG-90925
Change-Id: Idbc1379c89480225fc7a8d417416ed20404a1122
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-02-11 05:54:15 +00:00
Li Xinwei
29a58af4ca CMake: Fix HAVE_openssl config test when using static OpenSSL
When using static OpenSSL, HAVE_openssl test will fail, because of
unresolved external symbols. These symbols are from Ws2_32.lib and
Crypt32.lib, which CMake does not link by default. In qmake build
system, we can use OPENSSL_LIBS variable to specify these system
libraries. But there is no similar variable in CMake build system.
Accordingly, we should let OpenSSL::Crypto target link these libraries.

Upstream issue:
https://gitlab.kitware.com/cmake/cmake/-/issues/19263

Pick-to: 6.0
Change-Id: I5f27790b251d0a0f71aaf2aed2b933aeb3326f1f
Reviewed-by: Craig Scott <craig.scott@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-01-28 18:21:06 +00:00
Alexandru Croitor
e0346df1b2 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>
2020-04-08 22:03:24 +02:00