From f53f45038017e16a82b0f062c8d83843ee1bffe7 Mon Sep 17 00:00:00 2001 From: Mahavir Jain Date: Fri, 15 Nov 2019 14:23:00 +0530 Subject: [PATCH] nvs_flash: build nvs_encr.cpp only if relevant config option is enabled --- components/nvs_flash/CMakeLists.txt | 20 ++++++++++++-------- components/nvs_flash/component.mk | 4 ++++ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/components/nvs_flash/CMakeLists.txt b/components/nvs_flash/CMakeLists.txt index 1d7e5862dd..f305dbec3a 100644 --- a/components/nvs_flash/CMakeLists.txt +++ b/components/nvs_flash/CMakeLists.txt @@ -1,10 +1,14 @@ -idf_component_register(SRCS "src/nvs_api.cpp" - "src/nvs_encr.cpp" - "src/nvs_item_hash_list.cpp" - "src/nvs_ops.cpp" - "src/nvs_page.cpp" - "src/nvs_pagemanager.cpp" - "src/nvs_storage.cpp" - "src/nvs_types.cpp" +set(srcs "src/nvs_api.cpp" + "src/nvs_item_hash_list.cpp" + "src/nvs_ops.cpp" + "src/nvs_page.cpp" + "src/nvs_pagemanager.cpp" + "src/nvs_storage.cpp" + "src/nvs_types.cpp") +if(CONFIG_NVS_ENCRYPTION) + list(APPEND srcs "src/nvs_encr.cpp") +endif() + +idf_component_register(SRCS "${srcs}" REQUIRES spi_flash mbedtls INCLUDE_DIRS include) diff --git a/components/nvs_flash/component.mk b/components/nvs_flash/component.mk index 2341ae7b4f..8b2fda4f54 100644 --- a/components/nvs_flash/component.mk +++ b/components/nvs_flash/component.mk @@ -5,3 +5,7 @@ COMPONENT_ADD_INCLUDEDIRS := include COMPONENT_SRCDIRS := src + +ifndef CONFIG_NVS_ENCRYPTION +COMPONENT_OBJEXCLUDE := src/nvs_encr.o +endif