cmake: fix linking when wolfSSL not in default paths
authorPetr Štetiar <ynezz@true.cz>
Thu, 10 Dec 2020 10:38:33 +0000 (11:38 +0100)
committerPetr Štetiar <ynezz@true.cz>
Thu, 10 Dec 2020 10:41:26 +0000 (11:41 +0100)
Fixes following issue when wolfSSL libs are installed in different
paths:

 /usr/bin/ld: cannot find -lwolfssl

Signed-off-by: Petr Štetiar <ynezz@true.cz>
CMakeLists.txt

index 315aeb87c80b5a61f78e28564d9c5f61992f7504..42c7f1fb00de34c39f0974882e3a91ef699ceb5b 100644 (file)
@@ -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)