CMakeLists.txt 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. idf_build_get_property(target IDF_TARGET)
  2. set(srcs "src/nvs_api.cpp"
  3. "src/nvs_cxx_api.cpp"
  4. "src/nvs_item_hash_list.cpp"
  5. "src/nvs_page.cpp"
  6. "src/nvs_pagemanager.cpp"
  7. "src/nvs_storage.cpp"
  8. "src/nvs_handle_simple.cpp"
  9. "src/nvs_handle_locked.cpp"
  10. "src/nvs_partition.cpp"
  11. "src/nvs_partition_lookup.cpp"
  12. "src/nvs_partition_manager.cpp"
  13. "src/nvs_types.cpp")
  14. idf_component_register(SRCS "${srcs}"
  15. REQUIRES "spi_flash"
  16. INCLUDE_DIRS "include"
  17. PRIV_INCLUDE_DIRS "private_include")
  18. # If we use the linux target, we need to redirect the crc functions to the linux
  19. if(${target} STREQUAL "linux")
  20. if(CONFIG_NVS_ENCRYPTION)
  21. # mbedtls isn't configured for building with linux or as mock target. It will draw in all kind of dependencies
  22. message(FATAL_ERROR "NVS currently doesn't support encryption if built for Linux.")
  23. endif()
  24. target_compile_options(${COMPONENT_LIB} PUBLIC "-DLINUX_TARGET")
  25. target_compile_options(${COMPONENT_LIB} PUBLIC --coverage)
  26. target_link_libraries(${COMPONENT_LIB} PUBLIC --coverage)
  27. endif()
  28. if(CONFIG_NVS_ENCRYPTION)
  29. target_sources(${COMPONENT_LIB} PRIVATE "src/nvs_encrypted_partition.cpp")
  30. target_link_libraries(${COMPONENT_LIB} PRIVATE idf::mbedtls)
  31. endif()
  32. target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")