CMakeLists.txt 976 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. idf_build_get_property(target IDF_TARGET)
  2. set(srcs
  3. "unity/src/unity.c")
  4. set(includes
  5. "include"
  6. "unity/src")
  7. set(requires "")
  8. if(CONFIG_UNITY_ENABLE_BACKTRACE_ON_FAIL)
  9. list(APPEND COMPONENT_PRIV_INCLUDEDIRS "include/priv")
  10. endif()
  11. if(CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER)
  12. list(APPEND srcs "unity_runner.c")
  13. list(APPEND srcs "unity_utils_freertos.c")
  14. endif()
  15. if(CONFIG_UNITY_ENABLE_FIXTURE)
  16. list(APPEND srcs "unity/extras/fixture/src/unity_fixture.c")
  17. list(APPEND includes "unity/extras/fixture/src")
  18. endif()
  19. if(NOT "${target}" STREQUAL "linux")
  20. list(APPEND srcs "unity_port_esp32.c")
  21. endif()
  22. idf_component_register(SRCS "${srcs}"
  23. INCLUDE_DIRS ${includes}
  24. REQUIRES ${requires})
  25. if(NOT "${target}" STREQUAL "linux")
  26. target_compile_definitions(${COMPONENT_LIB} PUBLIC
  27. -DUNITY_INCLUDE_CONFIG_H
  28. )
  29. endif()
  30. target_compile_options(${COMPONENT_LIB} PRIVATE -Wno-unused-const-variable)