diff options
author | Kevin Kane <kkane@microsoft.com> | 2020-11-03 11:03:29 -0800 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2020-12-10 09:17:55 +0100 |
commit | 026879e9f0d766ebe651e6d3fd9809e243928391 (patch) | |
tree | eacc4dd221ccb182c3930fee636ff75ca68e83b6 /src/CMakeLists.txt | |
parent | 4708fc3b105d661532e3526de890e2dd923a16ed (diff) | |
download | libssh-026879e9f0d766ebe651e6d3fd9809e243928391.tar.gz libssh-026879e9f0d766ebe651e6d3fd9809e243928391.tar.xz libssh-026879e9f0d766ebe651e6d3fd9809e243928391.zip |
cmake: Use OPENSSL_CRYPTO_LIBRARIES CMake variable when linking against OpenSSL
The build currently breaks when attempting to link libssh.so using a
statically-linked OpenSSL. -ldl and -lpthread are required when linking
a binary with the static libcrypto.a. The OPENSSL_CRYPTO_LIBRARY does
not include these dependencies when linking against static OpenSSL.
OPENSSL_CRYPTO_LIBRARIES contains the correct dependencies in both
static and shared configurations; -ldl and -lpthread are not required
when linking against shared libcrypto.so.
This change changes all uses of OPENSSL_CRYPTO_LIBRARY to
OPENSSL_CRYPTO_LIBRARIES to let the FindOpenSSL CMake module always
provide the correct libraries at link time.
Signed-off-by: Kevin Kane <kkane@microsoft.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r-- | src/CMakeLists.txt | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 621f8b35..dd765de1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -16,7 +16,7 @@ if (WIN32) ) endif (WIN32) -if (OPENSSL_CRYPTO_LIBRARY) +if (OPENSSL_CRYPTO_LIBRARIES) set(LIBSSH_PRIVATE_INCLUDE_DIRS ${LIBSSH_PRIVATE_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIR} @@ -24,9 +24,9 @@ if (OPENSSL_CRYPTO_LIBRARY) set(LIBSSH_LINK_LIBRARIES ${LIBSSH_LINK_LIBRARIES} - ${OPENSSL_CRYPTO_LIBRARY} + ${OPENSSL_CRYPTO_LIBRARIES} ) -endif (OPENSSL_CRYPTO_LIBRARY) +endif (OPENSSL_CRYPTO_LIBRARIES) if (MBEDTLS_CRYPTO_LIBRARY) set(LIBSSH_PRIVATE_INCLUDE_DIRS |