diff --git a/cmake/deps/coap.cmake b/cmake/deps/coap.cmake index cb5ea9d853e..d095e3a3425 100644 --- a/cmake/deps/coap.cmake +++ b/cmake/deps/coap.cmake @@ -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()