Skip to content

Commit

Permalink
library order in MbedTLS finder
Browse files Browse the repository at this point in the history
  • Loading branch information
huitema committed May 16, 2024
1 parent 98cd809 commit c45a1cd
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions cmake/FindMbedTLS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,20 @@ ENDIF ()

# find libraries
FIND_LIBRARY(MBEDTLS_LIBRARY mbedtls HINTS ${MBEDTLS_LIBDIR})
FIND_LIBRARY(MBEDTLS_CRYPTO mbedcrypto HINTS ${MBEDTLS_LIBDIR})
FIND_LIBRARY(MBEDTLS_X509 mbedx509 HINTS ${MBEDTLS_LIBDIR})
FIND_LIBRARY(MBEDTLS_CRYPTO mbedcrypto HINTS ${MBEDTLS_LIBDIR})

# setup
# setup.
# Mbedtls depends on mbedtls x509 and mbedtls crypto.
# Mbedtls x509 depends on mbedtls crypto
# The order of libraries must be mbetls, then x509, then crypto,
# in order to avoid linker issues.
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MbedTLS REQUIRED_VARS
MBEDTLS_LIBRARY
MBEDTLS_CRYPTO
MBEDTLS_X509
MBEDTLS_CRYPTO
MBEDTLS_INCLUDE_DIRS)
IF (MbedTLS_FOUND)
SET(MBEDTLS_LIBRARIES ${MBEDTLS_LIBRARY} ${MBEDTLS_CRYPTO} ${MBEDTLS_X509})
SET(MBEDTLS_LIBRARIES ${MBEDTLS_LIBRARY} ${MBEDTLS_X509} ${MBEDTLS_CRYPTO})
MARK_AS_ADVANCED(MBEDTLS_LIBRARIES MBEDTLS_INCLUDE_DIRS)
ENDIF ()

0 comments on commit c45a1cd

Please sign in to comment.