1set(asio_sources "asio/asio/src/asio.cpp")
2
3if(CONFIG_ASIO_SSL_SUPPORT)
4    if(CONFIG_ASIO_USE_ESP_OPENSSL)
5        list(APPEND asio_sources
6                "asio/asio/src/asio_ssl.cpp"
7                "port/src/esp_asio_openssl_stubs.c")
8    endif()
9
10    if(CONFIG_ASIO_USE_ESP_WOLFSSL)
11        list(APPEND asio_sources
12                "asio/asio/src/asio_ssl.cpp")
13    endif()
14endif()
15
16idf_component_register(SRCS ${asio_sources}
17                    INCLUDE_DIRS "asio/asio/include" "port/include"
18                    REQUIRES lwip)
19
20if(CONFIG_ASIO_SSL_SUPPORT)
21    if(CONFIG_ASIO_USE_ESP_WOLFSSL)
22        idf_component_get_property(wolflib esp-wolfssl COMPONENT_LIB)
23        idf_component_get_property(wolfdir esp-wolfssl COMPONENT_DIR)
24
25        target_link_libraries(${COMPONENT_LIB} PUBLIC ${wolflib})
26        target_include_directories(${COMPONENT_LIB} PUBLIC ${wolfdir}/wolfssl/wolfssl)
27    endif()
28
29    if(CONFIG_ASIO_USE_ESP_OPENSSL)
30        idf_component_get_property(esp_openssl openssl COMPONENT_LIB)
31        target_link_libraries(${COMPONENT_LIB} PUBLIC ${esp_openssl})
32    endif()
33endif()
34