From 2acac6b848f2c8b000f05733fca1c2aaf5ee5f0b Mon Sep 17 00:00:00 2001 From: "radek.tandler" Date: Sat, 24 Feb 2024 01:13:35 +0100 Subject: [PATCH] fix(nvs): Adopted CMakeLists for host test if IDF v5.1 --- components/nvs_flash/CMakeLists.txt | 11 ++++++++--- components/spi_flash/CMakeLists.txt | 2 ++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/components/nvs_flash/CMakeLists.txt b/components/nvs_flash/CMakeLists.txt index 0f1dde708e..df4b312fd8 100644 --- a/components/nvs_flash/CMakeLists.txt +++ b/components/nvs_flash/CMakeLists.txt @@ -1,5 +1,11 @@ idf_build_get_property(target IDF_TARGET) +if(${target} STREQUAL "linux") +# omit newlib for linux +else() + list(APPEND priv_requires "newlib") +endif() + set(srcs "src/nvs_api.cpp" "src/nvs_cxx_api.cpp" "src/nvs_item_hash_list.cpp" @@ -15,10 +21,9 @@ set(srcs "src/nvs_api.cpp" "src/nvs_platform.cpp") idf_component_register(SRCS "${srcs}" - REQUIRES "esp_partition" - PRIV_REQUIRES spi_flash newlib + REQUIRES "esp_partition" "spi_flash" + PRIV_REQUIRES "${priv_requires}" INCLUDE_DIRS "include" - "../spi_flash/include" PRIV_INCLUDE_DIRS "private_include") # If we use the linux target, we need to redirect the crc functions to the linux diff --git a/components/spi_flash/CMakeLists.txt b/components/spi_flash/CMakeLists.txt index e6242bd07f..0baab36924 100644 --- a/components/spi_flash/CMakeLists.txt +++ b/components/spi_flash/CMakeLists.txt @@ -1,5 +1,7 @@ idf_build_get_property(target IDF_TARGET) if(${target} STREQUAL "linux") + idf_component_register(INCLUDE_DIRS include + PRIV_INCLUDE_DIRS include/spi_flash) return() endif()