CMakeLists.txt 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. set(srcs esp_tls.c esp-tls-crypto/esp_tls_crypto.c esp_tls_error_capture.c)
  2. if(CONFIG_ESP_TLS_USING_MBEDTLS)
  3. list(APPEND srcs
  4. "esp_tls_mbedtls.c")
  5. endif()
  6. if(CONFIG_ESP_TLS_USING_WOLFSSL)
  7. list(APPEND srcs
  8. "esp_tls_wolfssl.c")
  9. endif()
  10. set(priv_req http_parser)
  11. if(NOT ${IDF_TARGET} STREQUAL "linux")
  12. list(APPEND priv_req lwip)
  13. endif()
  14. idf_component_register(SRCS "${srcs}"
  15. INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} esp-tls-crypto
  16. PRIV_INCLUDE_DIRS "private_include"
  17. # mbedtls is public requirements becasue esp_tls.h
  18. # includes mbedtls header files.
  19. REQUIRES mbedtls
  20. PRIV_REQUIRES ${priv_req})
  21. if(CONFIG_ESP_TLS_USING_WOLFSSL)
  22. idf_component_get_property(wolfssl esp-wolfssl COMPONENT_LIB)
  23. target_link_libraries(${COMPONENT_LIB} PUBLIC ${wolfssl})
  24. endif()
  25. if(NOT ${IDF_TARGET} STREQUAL "linux")
  26. # Increase link multiplicity to get some lwip symbols correctly resolved by the linker
  27. # due to cyclic dependencies present in IDF for lwip/esp_netif/mbedtls
  28. idf_component_get_property(lwip lwip COMPONENT_LIB)
  29. set_property(TARGET ${lwip} APPEND PROPERTY LINK_INTERFACE_MULTIPLICITY 5)
  30. else()
  31. # Check if LWIP in the build for linux target to adapt esp-tls compatibility layer
  32. idf_build_get_property(build_components BUILD_COMPONENTS)
  33. if(CONFIG_LWIP_ENABLE)
  34. target_compile_definitions(${COMPONENT_LIB} PRIVATE ESP_TLS_WITH_LWIP=1)
  35. endif()
  36. endif()
  37. if(CONFIG_ESP_TLS_USE_SECURE_ELEMENT)
  38. idf_component_optional_requires(PRIVATE espressif__esp-cryptoauthlib esp-cryptoauthlib)
  39. endif()