[PATCH ustream-ssl 02/12] cmake: fix linking when wolfSSL not in default paths

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


Fixes following issue when wolfSSL libs are installed in different
paths:

 /usr/bin/ld: cannot find -lwolfssl

Signed-off-by: Petr Štetiar <ynezz at true.cz>
---
 CMakeLists.txt | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 315aeb87c80b..42c7f1fb00de 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -13,9 +13,10 @@ IF(MBEDTLS)
   SET(SSL_LIB mbedtls mbedcrypto mbedx509 m)
 ELSEIF(WOLFSSL)
   ADD_DEFINITIONS(-DHAVE_WOLFSSL)
+  FIND_LIBRARY(wolfssl_library wolfssl)
   SET(SSL_SRC ustream-io-wolfssl.c ustream-openssl.c)
-  SET(SSL_LIB wolfssl m)
-  SET(CMAKE_REQUIRED_LIBRARIES "-lwolfssl -lm")
+  SET(SSL_LIB ${wolfssl_library} m)
+  SET(CMAKE_REQUIRED_LIBRARIES "${wolfssl_library} -lm")
   CHECK_SYMBOL_EXISTS (wolfSSL_SSLSetIORecv "wolfssl/ssl.h"
 		       HAVE_WOLFSSL_SSLSETIORECV)
   IF (NOT HAVE_WOLFSSL_SSLSETIORECV)



More information about the openwrt-devel mailing list