So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By nimble2017
#83369 Hello,

I use similar following code structure for my project:

- myProject/
- CMakeLists.txt
- sdkconfig
- components/ - component1/ - CMakeLists.txt
- Kconfig
- src1.c
- component2/ - CMakeLists.txt
- Kconfig
- src2.c
- inc/ - component2.h
- main/ - src3.c
- src4.c

- build/

It is similar to the one described in the ESP official build-system guide. The question is: if src2.c above includes component2.h, how to include 'inc' directory in CMakeLists.txt of component2 ? Without 'inc' directory being set properly, the compiler would fail to find component2.h in order to compile the src2.c. Otherwise, I have to put component2.h in the same directory as src2.c file.

The COMPONENT_ADD_INCLUDEDDIRS only applies to source files under main directory but component source files.

Thanks in advance,