I’m new to ESP-IDF and Platformio.
I want to add my source files in CMakeLists.txt by folders, not one by one as files. This should be done by SRC_DIRS but it doesn’t work for me, the files, that are under “uart” directory do not compile and do not link. When I write them one by one in “SRCS”, then it works. How can I get it fixed?
Per Build System - ESP32 - — ESP-IDF Programming Guide latest documentation this looks good. Have you tried cleaning the entire project again rebuilding it? (project task “Clean” then “Build”)
of course. As well as trying to put “uart/” or without apostrophes.
I think I figured it out. In the documentation for this function it says
idf_component_register([[SRCS src1 src2 ...] | [[SRC_DIRS dir1 dir2 ...] [EXCLUDE_SRCS src1 src2 ...]]
Notice the “OR” bar between SRCS and SRC_DIRS. This made me think that I can either use either SRCS or SRC_DIRS, but not both at the same time. So following works
idf_component_register(SRC_DIRS "." "uart")
Notice, however, that you have to run reconfigure or clean build each time you add a new source.