1if(NOT CONFIG_LWIP_IPV6 AND NOT CMAKE_BUILD_EARLY_EXPANSION)
2    message(STATUS "IPV6 support is disabled so the coap component will not be built")
3    # note: the component is still included in the build so it can become visible again in config
4    # without needing to re-run CMake. However no source or header files are built.
5    idf_component_register()
6    return()
7endif()
8
9set(include_dirs port/include port/include libcoap/include)
10
11set(srcs
12    "libcoap/src/address.c"
13    "libcoap/src/async.c"
14    "libcoap/src/block.c"
15    "libcoap/src/coap_asn1.c"
16    "libcoap/src/coap_cache.c"
17    "libcoap/src/coap_debug.c"
18    "libcoap/src/coap_event.c"
19    "libcoap/src/coap_hashkey.c"
20    "libcoap/src/coap_io.c"
21    "libcoap/src/coap_mbedtls.c"
22    "libcoap/src/coap_notls.c"
23    "libcoap/src/coap_prng.c"
24    "libcoap/src/coap_session.c"
25    "libcoap/src/coap_tcp.c"
26    "libcoap/src/coap_time.c"
27    "libcoap/src/encode.c"
28    "libcoap/src/mem.c"
29    "libcoap/src/net.c"
30    "libcoap/src/option.c"
31    "libcoap/src/pdu.c"
32    "libcoap/src/resource.c"
33    "libcoap/src/str.c"
34    "libcoap/src/subscribe.c"
35    "libcoap/src/uri.c")
36
37idf_component_register(SRCS "${srcs}"
38                    INCLUDE_DIRS "${include_dirs}"
39                    REQUIRES lwip mbedtls)
40
41# Silence format truncation warning, until it is fixed upstream
42# set_source_files_properties(libcoap/src/coap_debug.c PROPERTIES COMPILE_FLAGS -Wno-format-truncation)
43
44# Needed for coap headers in public builds, also.
45#
46# TODO: find a way to move this to a port header
47target_compile_definitions(${COMPONENT_LIB} PUBLIC WITH_POSIX)
48