diff mbox series

[ustream-ssl,03/12] cmake: fix linking when mbed TLS not in default paths

Message ID 20201210154134.794-4-ynezz@true.cz
State Accepted
Delegated to: Petr Štetiar
Headers show
Series fixes, improvements and CI | expand

Commit Message

Petr Štetiar Dec. 10, 2020, 3:41 p.m. UTC
Fixes following issue when mbed TLS libs are installed in different
paths:

 /usr/bin/ld: cannot find -lmbedtls
 /usr/bin/ld: cannot find -lmbedcrypto
 /usr/bin/ld: cannot find -lmbedx509

Signed-off-by: Petr Štetiar <ynezz@true.cz>
---
 CMakeLists.txt | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 42c7f1fb00de..bb2abe5af596 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,7 +10,10 @@  SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
 IF(MBEDTLS)
   ADD_DEFINITIONS(-DHAVE_MBEDTLS)
   SET(SSL_SRC ustream-mbedtls.c)
-  SET(SSL_LIB mbedtls mbedcrypto mbedx509 m)
+  FIND_LIBRARY(mbedtls_library mbedtls)
+  FIND_LIBRARY(mbedx509_library mbedx509)
+  FIND_LIBRARY(mbedcrypto_library mbedcrypto)
+  SET(SSL_LIB ${mbedtls_library} ${mbedx509_library} ${mbedcrypto_library} m)
 ELSEIF(WOLFSSL)
   ADD_DEFINITIONS(-DHAVE_WOLFSSL)
   FIND_LIBRARY(wolfssl_library wolfssl)