cmake: Fixed compatibility issues with "CPM.cmake" in combination with the libraries MBedTLS and libgcrypt.

Signed-off-by: Davidwed <davidwe@posteo.de>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
(cherry picked from commit 7712c7d0f9)
This commit is contained in:
Davidwed
2024-09-03 11:43:32 +02:00
committed by Jakub Jelen
parent 747dd17e64
commit 771dc30f79
3 changed files with 70 additions and 23 deletions

View File

@@ -1,6 +1,7 @@
set(LIBSSH_PUBLIC_INCLUDE_DIRS ${libssh_SOURCE_DIR}/include)
set(LIBSSH_PRIVATE_INCLUDE_DIRS
${libssh_BINARY_DIR}/include
${libssh_BINARY_DIR}
)
@@ -12,27 +13,13 @@ if (TARGET OpenSSL::Crypto)
list(APPEND LIBSSH_LINK_LIBRARIES OpenSSL::Crypto)
endif ()
if (MBEDTLS_CRYPTO_LIBRARY)
set(LIBSSH_PRIVATE_INCLUDE_DIRS
${LIBSSH_PRIVATE_INCLUDE_DIRS}
${MBEDTLS_INCLUDE_DIR}
)
set(LIBSSH_LINK_LIBRARIES
${LIBSSH_LINK_LIBRARIES}
${MBEDTLS_CRYPTO_LIBRARY}
)
endif (MBEDTLS_CRYPTO_LIBRARY)
if (TARGET MbedTLS::mbedcrypto)
list(APPEND LIBSSH_LINK_LIBRARIES MbedTLS::mbedcrypto)
endif ()
if (GCRYPT_LIBRARIES)
set(LIBSSH_PRIVATE_INCLUDE_DIRS
${LIBSSH_PRIVATE_INCLUDE_DIRS}
${GCRYPT_INCLUDE_DIR}
)
set(LIBSSH_LINK_LIBRARIES
${LIBSSH_LINK_LIBRARIES}
${GCRYPT_LIBRARIES})
endif()
if (TARGET libgcrypt::libgcrypt)
list(APPEND LIBSSH_LINK_LIBRARIES ${GCRYPT_LIBRARIES})
endif ()
if (WITH_ZLIB)
list(APPEND LIBSSH_LINK_LIBRARIES ZLIB::ZLIB)