From 374945346ab16e7a637ac736e8ba9bd88b03e839 Mon Sep 17 00:00:00 2001 From: SJunkies <41368976+SJunkies@users.noreply.github.com> Date: Mon, 27 Jul 2020 17:53:19 +0200 Subject: [PATCH] Fix: -DUSE_SYSTEM_MBEDTLS_LIBS=ON - undefined reference (#898) --- cmake/Findmbedtls.cmake | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/cmake/Findmbedtls.cmake b/cmake/Findmbedtls.cmake index 9fd21bc7..f243c924 100644 --- a/cmake/Findmbedtls.cmake +++ b/cmake/Findmbedtls.cmake @@ -5,6 +5,7 @@ find_library(MBEDTLS_X509_LIBRARY mbedx509) find_library(MBEDTLS_CRYPTO_LIBRARY mbedcrypto) set(MBEDTLS_LIBRARIES ${MBEDTLS_SSL_LIBRARY} ${MBEDTLS_X509_LIBRARY} ${MBEDTLS_CRYPTO_LIBRARY}) +set(MBEDTLS_LIBRARIES ${MBEDTLS_LIBRARIES} PARENT_SCOPE) if (MBEDTLS_INCLUDE_DIR AND EXISTS "${MBEDTLS_INCLUDE_DIR}/mbedtls/version.h") file(STRINGS "${MBEDTLS_INCLUDE_DIR}/mbedtls/version.h" _MBEDTLS_VERSION_STRING REGEX "^#[\t ]*define[\t ]+MBEDTLS_VERSION_STRING[\t ]+\"[0-9]+.[0-9]+.[0-9]+\"") @@ -12,14 +13,17 @@ if (MBEDTLS_INCLUDE_DIR AND EXISTS "${MBEDTLS_INCLUDE_DIR}/mbedtls/version.h") endif () if (MBEDTLS_INCLUDE_DIR AND MBEDTLS_LIBRARIES AND MBEDTLS_VERSION) - find_package_handle_standard_args(mbedtls - REQUIRED_VARS - MBEDTLS_INCLUDE_DIR - MBEDTLS_LIBRARIES - VERSION_VAR - MBEDTLS_VERSION - ) - mark_as_advanced (MBEDTLS_INCLUDE_DIR MBEDTLS_LIBRARIES MBEDTLS_SSL_LIBRARY MBEDTLS_X509_LIBRARY MBEDTLS_CRYPTO_LIBRARY) + include(FindPackageHandleStandardArgs) + + find_package_handle_standard_args(mbedtls + REQUIRED_VARS + MBEDTLS_INCLUDE_DIR + MBEDTLS_LIBRARIES + VERSION_VAR + MBEDTLS_VERSION + ) + + mark_as_advanced (MBEDTLS_INCLUDE_DIR MBEDTLS_LIBRARIES MBEDTLS_SSL_LIBRARY MBEDTLS_X509_LIBRARY MBEDTLS_CRYPTO_LIBRARY) endif (MBEDTLS_INCLUDE_DIR AND MBEDTLS_LIBRARIES AND MBEDTLS_VERSION)