Question 1:
I'm creating a new project using the example "nvs_rw_value" as a template. I've started porting some of that code to a folder located here: main/Middleware/Tools/NONVOL.c.
When I build, I get an error saying "nvs_flash.h: No such file or directory"
There was no problem with including nvs_flash.h with the fresh example project that had this code was in the main directory.
Here is my top-level CMakeLists.txt file:
Code: Select all
cmake_minimum_required(VERSION 3.16)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(project)
enable_language(C)
set(SOURCE_FILES
main/APP.c
main/APP.h
main/APP__CONFIG.h
main/Middleware/Tools/DEBUG.c)
add_executable(${PROJECT_NAME} ${SOURCE_FILES})
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/)
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Middleware/Tools)
Question 2:
Why do I need a separate CMakeLists.txt for each subdirectory (I guess these are called "Components")?
What do I put in these files? Do I just list all my .C files for that subdirectory?