CMakeLists.txt 929 B

123456789101112131415161718192021222324252627282930313233343536373839
  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. endif()
  14. if(CONFIG_UNITY_ENABLE_FIXTURE)
  15. list(APPEND srcs "unity/extras/fixture/src/unity_fixture.c")
  16. list(APPEND includes "unity/extras/fixture/src")
  17. endif()
  18. if(NOT "${target}" STREQUAL "linux")
  19. list(APPEND srcs "unity_port_esp32.c")
  20. endif()
  21. idf_component_register(SRCS "${srcs}"
  22. INCLUDE_DIRS ${includes}
  23. REQUIRES ${requires})
  24. if(NOT "${target}" STREQUAL "linux")
  25. target_compile_definitions(${COMPONENT_LIB} PUBLIC
  26. -DUNITY_INCLUDE_CONFIG_H
  27. )
  28. endif()
  29. target_compile_options(${COMPONENT_LIB} PRIVATE -Wno-unused-const-variable)