diff options
author | Kai Koehne <kai.koehne@qt.io> | 2019-07-31 12:53:47 +0200 |
---|---|---|
committer | Kai Koehne <kai.koehne@qt.io> | 2019-09-19 08:58:44 +0200 |
commit | 6bffb8e3e147c329315529007499d5a05ae304f5 (patch) | |
tree | 0088d9c92b128f150074926bd5a07592aa882866 | |
parent | 52ad1de1f68c5c31b64f6ef6e1a0bdedf5a61f0f (diff) |
Update hints on how to link to OpenSSL
The traditional way to fix building against a custom OpenSSL is to set the
OPENSSL_LIBS environment variable.
Anyhow, since Qt 5.6 there's a more generic way to configure
linking against external libraries by configuring the <LIB>_INCDIR, <LIB>_LIBDIR,
<LIB>_PREFIX, <LIB>_LIBS, <LIB>_LIBS_DEBUG and <LIB>_LIBS_RELEASE
qmake variables at configure time. Using these have following advantages:
- Can handle different libs for a -debug-and-release build
- Can be used also for other libs than just openssl
So let's try to promote this.
Also update any examples for OpenSSL 1.1.
Change-Id: I24dbccdd87d0fc50bf31c6afe7aa692d4b810fb7
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
-rw-r--r-- | src/network/configure.json | 5 | ||||
-rw-r--r-- | src/network/doc/src/ssl.qdoc | 5 | ||||
-rw-r--r-- | src/network/ssl/ssl.pri | 4 |
3 files changed, 7 insertions, 7 deletions
diff --git a/src/network/configure.json b/src/network/configure.json index 2c005f0efb..47a4ec12f2 100644 --- a/src/network/configure.json +++ b/src/network/configure.json @@ -352,9 +352,10 @@ "condition": "features.openssl-linked && libs.openssl.source != 0 && input.openssl.prefix == '' && input.openssl.libs == '' && input.openssl.libs.debug == ''", "message": "When linking against OpenSSL, you can override the default -library names through OPENSSL_LIBS. +library names and directories with setting OPENSSL_PREFIX (or OPENSSL_INCDIR, OPENSSL_LIBDIR), +and OPENSSL_LIBS, OPENSSL_LIBS_DEBUG, OPENSSL_LIBS_RELEASE. For example: - OPENSSL_LIBS='-L/opt/ssl/lib -lssl -lcrypto' ./configure -openssl-linked" + ./configure -openssl-linked OPENSSL_PREFIX='/opt/ssl' OPENSSL_LIBS='-lssl -lcrypto'" }, { "type": "warning", diff --git a/src/network/doc/src/ssl.qdoc b/src/network/doc/src/ssl.qdoc index a3af1d0477..1de5cf26c1 100644 --- a/src/network/doc/src/ssl.qdoc +++ b/src/network/doc/src/ssl.qdoc @@ -55,12 +55,11 @@ When building a version of Qt linked against OpenSSL, the build system will attempt to link with libssl and libcrypt libraries located in the default location on the developer's system. This location is configurable: - set the \c OPENSSL_LIBS environment variable to contain the linker options - required to link Qt against the installed library. For example, on a Unix/Linux + set the \c OPENSSL_LIBDIR command line argument. For example, on Unix/Linux system: \code - OPENSSL_LIBS='-L/opt/ssl/lib -lssl -lcrypto' ./configure -openssl-linked + ./configure -openssl-linked OPENSSL_LIBDIR=/usr/local/ssl \endcode To disable SSL support in a Qt build, configure Qt with the \c{-no-openssl} diff --git a/src/network/ssl/ssl.pri b/src/network/ssl/ssl.pri index 6975264038..a5ec29007a 100644 --- a/src/network/ssl/ssl.pri +++ b/src/network/ssl/ssl.pri @@ -102,9 +102,9 @@ qtConfig(ssl) { # Add optional SSL libs # Static linking of OpenSSL with msvc: # - Binaries http://slproweb.com/products/Win32OpenSSL.html - # - also needs -lUser32 -lAdvapi32 -lGdi32 -lCrypt32 + # - also needs -lWs2_32 -lGdi32 -lAdvapi32 -lCrypt32 -lUser32 # - libs in <OPENSSL_DIR>\lib\VC\static - # - configure: -openssl -openssl-linked -I <OPENSSL_DIR>\include -L <OPENSSL_DIR>\lib\VC\static OPENSSL_LIBS="-lUser32 -lAdvapi32 -lGdi32" OPENSSL_LIBS_DEBUG="-lssleay32MDd -llibeay32MDd" OPENSSL_LIBS_RELEASE="-lssleay32MD -llibeay32MD" + # - configure: -openssl-linked -openssl-linked OPENSSL_INCDIR="%OPENSSL_DIR%\include" OPENSSL_LIBDIR="%OPENSSL_DIR%\lib\VC\static" OPENSSL_LIBS="-lWs2_32 -lGdi32 -lAdvapi32 -lCrypt32 -lUser32" OPENSSL_LIBS_DEBUG="-llibssl64MDd -llibcrypto64MDd" OPENSSL_LIBS_RELEASE="-llibssl64MD -llibcrypto64MD" qtConfig(openssl-linked): \ QMAKE_USE_FOR_PRIVATE += openssl |