How to Properly Use Src_Dirs Parameter in Idf_Component_Register Function in Esp-Idf?
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...
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. How can I get it done?
1 Answer
So I think I figured it out. In the docs
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, as @Tarmo noticed, that you have to run reconfigure or clean build each time you add a new source.