CMakeLists.txt 988 B

12345678910111213141516171819202122
  1. set(srcs main.c ../../common/example_common.c)
  2. set(include_dirs . ../../common)
  3. if ("${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}" VERSION_GREATER "4.0")
  4. idf_component_register(SRCS ${srcs}
  5. INCLUDE_DIRS ${include_dirs})
  6. set(target ${COMPONENT_LIB})
  7. else()
  8. # remove when dropping IDF 3.3 support
  9. set(COMPONENT_SRCS ${srcs})
  10. set(COMPONENT_ADD_INCLUDEDIRS ${include_dirs})
  11. register_component()
  12. set(target ${COMPONENT_TARGET})
  13. endif()
  14. # Embed binaries into the app.
  15. # In ESP-IDF this can also be done using EMBED_FILES option of idf_component_register.
  16. # Here an external tool is used to make file embedding similar with other ports.
  17. include(${CMAKE_CURRENT_LIST_DIR}/../../common/bin2array.cmake)
  18. create_resources(${CMAKE_CURRENT_LIST_DIR}/../../binaries/Hello-world ${CMAKE_BINARY_DIR}/binaries.c)
  19. set_property(SOURCE ${CMAKE_BINARY_DIR}/binaries.c PROPERTY GENERATED 1)
  20. target_sources(${target} PRIVATE ${CMAKE_BINARY_DIR}/binaries.c)