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

Petr Štetiar ynezz at true.cz
Thu Dec 10 10:41:25 EST 2020


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 at true.cz>
---
 CMakeLists.txt | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

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)



More information about the openwrt-devel mailing list