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?

enter image description here

8

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.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.