Skip to content

Commit

Permalink
[ci] Fix coap .a sometimes requiring linking against gnutls
Browse files Browse the repository at this point in the history
  • Loading branch information
jcelerier committed Jun 8, 2024
1 parent 23f64e4 commit 130e64f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cmake/deps/coap.cmake
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
if(OSSIA_USE_SYSTEM_LIBRARIES)
find_path(LIBCOAP_INCLUDEDIR coap3/libcoap.h)
find_library(LIBCOAP_GNUTLS_LIBRARIES coap-3-gnutls)
find_library(LIBCOAP_LIBRARIES coap-3)

if(LIBCOAP_INCLUDEDIR AND LIBCOAP_LIBRARIES)
if(LIBCOAP_INCLUDEDIR AND (LIBCOAP_LIBRARIES OR LIBCOAP_GNUTLS_LIBRARIES))
add_library(coap-3 IMPORTED SHARED GLOBAL)
add_library(libcoap::coap-3 ALIAS coap-3)
target_include_directories(coap-3 INTERFACE "${LIBCOAP_INCLUDEDIR}")
set_target_properties(coap-3 PROPERTIES IMPORTED_LOCATION "${LIBCOAP_LIBRARIES}")
if(LIBCOAP_GNUTLS_LIBRARIES)
set_target_properties(coap-3 PROPERTIES IMPORTED_LOCATION "${LIBCOAP_GNUTLS_LIBRARIES}")
target_link_libraries(coap-3 INTERFACE gnutls)
else()
set_target_properties(coap-3 PROPERTIES IMPORTED_LOCATION "${LIBCOAP_LIBRARIES}")
endif()
endif()
endif()

Expand Down

0 comments on commit 130e64f

Please sign in to comment.