summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMikael Magnusson <mikma@users.sourceforge.net>2024-09-14 21:05:37 +0200
committerMikael Magnusson <mikma@users.sourceforge.net>2024-09-14 21:05:37 +0200
commit11c26eadf00c77ff11ac7f1b6e03ce9da51d670c (patch)
tree6f3813f7e4378185f7a8790b1a176c332ee03a10
parent52d471942cc6f3e84604bdd8589da090710f2c1a (diff)
crypto: fix CMakeLists
-rw-r--r--CMakeLists.txt14
1 files changed, 14 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4564818..80546c0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -29,6 +29,7 @@ find_library(libubox NAMES ubox)
find_library(libubus NAMES ubus)
find_library(libblobmsg_json NAMES blobmsg_json)
find_package(ZLIB)
+find_package(MbedTLS)
if(LINUX)
find_library(libnl_tiny NAMES nl-tiny)
@@ -54,6 +55,10 @@ if(ZLIB_FOUND)
set(DEFAULT_ZLIB_SUPPORT ON)
endif()
+if(MbedTLS_FOUND)
+ set(DEFAULT_CRYPTO_MBEDTLS_SUPPORT ON)
+endif()
+
option(DEBUG_SUPPORT "Debug plugin support" ON)
option(FS_SUPPORT "Filesystem plugin support" ON)
option(MATH_SUPPORT "Math plugin support" ON)
@@ -67,6 +72,7 @@ option(ULOOP_SUPPORT "Uloop plugin support" ${DEFAULT_ULOOP_SUPPORT})
option(LOG_SUPPORT "Log plugin support" ON)
option(SOCKET_SUPPORT "Socket plugin support" ON)
option(ZLIB_SUPPORT "Zlib plugin support" ${DEFAULT_ZLIB_SUPPORT})
+option(CRYPTO_MBEDTLS_SUPPORT "Crypto Mbed-TLS plugin support" ${DEFAULT_CRYPTO_MBEDTLS_SUPPORT})
set(LIB_SEARCH_PATH "${CMAKE_INSTALL_PREFIX}/lib/ucode/*.so:${CMAKE_INSTALL_PREFIX}/share/ucode/*.uc:./*.so:./*.uc" CACHE STRING "Default library search path")
string(REPLACE ":" "\", \"" LIB_SEARCH_DEFINE "${LIB_SEARCH_PATH}")
@@ -290,6 +296,14 @@ if(ZLIB_SUPPORT)
target_link_libraries(zlib_lib ZLIB::ZLIB)
endif()
+if(MBEDTLS_SUPPORT)
+ set(LIBRARIES ${LIBRARIES} crypto_mbedtls_lib)
+ add_library(crypto_mbedtls_lib MODULE lib/crypto-mbedtls.c)
+ set_target_properties(crypto_mbedtls_lib PROPERTIES OUTPUT_NAME crypto-mbedtls PREFIX "")
+ target_link_options(crypto_mbedtls_lib PRIVATE ${UCODE_MODULE_LINK_OPTIONS})
+ target_link_libraries(crypto_mbedtls_lib PUBLIC MbedTLS::mbedtls)
+endif()
+
if(UNIT_TESTING)
enable_testing()
add_definitions(-DUNIT_TESTING)