CMakeLists.txt 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. if(NOT CONFIG_LWIP_IPV6 AND NOT CMAKE_BUILD_EARLY_EXPANSION)
  2. # note: the component is still included in the build so it can become visible again in config
  3. # without needing to re-run CMake. However no source or header files are built.
  4. message(STATUS "IPV6 support is disabled so the asio component will not be built")
  5. idf_component_register()
  6. return()
  7. endif()
  8. set(asio_sources "asio/asio/src/asio.cpp")
  9. if(CONFIG_ASIO_SSL_SUPPORT)
  10. if(CONFIG_ASIO_USE_ESP_OPENSSL)
  11. list(APPEND asio_sources
  12. "asio/asio/src/asio_ssl.cpp"
  13. "port/src/esp_asio_openssl_stubs.c")
  14. endif()
  15. if(CONFIG_ASIO_USE_ESP_WOLFSSL)
  16. list(APPEND asio_sources
  17. "asio/asio/src/asio_ssl.cpp")
  18. endif()
  19. endif()
  20. idf_component_register(SRCS ${asio_sources}
  21. INCLUDE_DIRS "asio/asio/include" "port/include"
  22. REQUIRES lwip)
  23. if(CONFIG_ASIO_SSL_SUPPORT)
  24. if(CONFIG_ASIO_USE_ESP_WOLFSSL)
  25. idf_component_get_property(wolflib esp-wolfssl COMPONENT_LIB)
  26. idf_component_get_property(wolfdir esp-wolfssl COMPONENT_DIR)
  27. target_link_libraries(${COMPONENT_LIB} PUBLIC ${wolflib})
  28. target_include_directories(${COMPONENT_LIB} PUBLIC ${wolfdir}/wolfssl/wolfssl)
  29. endif()
  30. if(CONFIG_ASIO_USE_ESP_OPENSSL)
  31. idf_component_get_property(esp_openssl openssl COMPONENT_LIB)
  32. target_link_libraries(${COMPONENT_LIB} PUBLIC ${esp_openssl})
  33. endif()
  34. endif()