mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-12 11:40:39 +03:00
feat(zephyr): support v4.4
- fix(cmake): only create alias if it doesn't exist: Zephyr v4.4 has moved to MbedTLS 4.x in following PR: https://github.com/zephyrproject-rtos/zephyr/pull/104031 Zephyr now uses MbedTLS' CMakeLists, which exports targets with NAMESPACE MbedTLS::, therefore MbedTLS::mbedtls, MbedTLS::mbedx509, MbedTLS::tfpsacrypto aliases already exist - fix(zephyr): v4.4: include correct mbedtls config based on zephyr version CONFIG_MBEDTLS_CFG_FILE was deprecated. Instead, CONFIG_MBEDTLS_CONFIG_FILE shall be used. This change supports both based on Kconfig symbols. Signed-off-by: Krisztian Szilvasi <34309983+kr-t@users.noreply.github.com>
This commit is contained in:
1 parent
8402c3bb8c
commit
d62f137bcd
2 files changed
+15
-4
No files matched your search
+11
-3
@@ -801,9 +801,17 @@ target_compile_options(
|
||||
PUBLIC -DLIBCOAP_PACKAGE_BUILD="${LIBCOAP_PACKAGE_BUILD}")
|
||||
|
||||
if(ZEPHYR_BASE)
|
||||
target_compile_options(
|
||||
${COAP_LIBRARY_NAME}
|
||||
PUBLIC -DMBEDTLS_CONFIG_FILE="${CONFIG_MBEDTLS_CFG_FILE}" -I${ZEPHYR_MBEDTLS_CMAKE_DIR}/configs)
|
||||
# Zephyr >= v4.4:
|
||||
if(DEFINED CONFIG_MBEDTLS_CONFIG_FILE)
|
||||
target_compile_options(${COAP_LIBRARY_NAME}
|
||||
PUBLIC -DMBEDTLS_CONFIG_FILE="${CONFIG_MBEDTLS_CONFIG_FILE}" -I${ZEPHYR_MBEDTLS_CMAKE_DIR}/configs)
|
||||
# Zephyr < v4.4:
|
||||
elseif(DEFINED CONFIG_MBEDTLS_CFG_FILE)
|
||||
target_compile_options(${COAP_LIBRARY_NAME}
|
||||
PUBLIC -DMBEDTLS_CONFIG_FILE="${CONFIG_MBEDTLS_CFG_FILE}" -I${ZEPHYR_MBEDTLS_CMAKE_DIR}/configs)
|
||||
else()
|
||||
message(WARNING "No usable MBEDTLS config Kconfig symbol found")
|
||||
endif()
|
||||
endif() # ! ZEPHYR_BASE
|
||||
|
||||
add_library(
|
||||
|
||||
@@ -159,7 +159,10 @@ if(CONFIG_LIBCOAP)
|
||||
if(CONFIG_MBEDTLS)
|
||||
if(TARGET mbedTLS)
|
||||
target_include_directories(mbedTLS INTERFACE ${ZEPHYR_LIBCOAP_MODULE_DIR}/include)
|
||||
add_library(MbedTLS::mbedtls ALIAS mbedTLS)
|
||||
# Only create alias if it doesn't already exist (Zephyr v4.4+ has it)
|
||||
if(NOT TARGET MbedTLS::mbedtls)
|
||||
add_library(MbedTLS::mbedtls ALIAS mbedTLS)
|
||||
endif()
|
||||
else()
|
||||
message(WARNING "mbedTLS target not found.")
|
||||
endif()
|
||||
|
||||
Reference in new issue
Block a user