Page 1 of 1

Component: Include header inside main folder

Posted: Sat May 15, 2021 9:54 am
by RichPiano
For a component I want to include a config header that's located under the main folder. How would I do that?

I know that you can specify the REQUIRES and PRIV_REQUIRES fields in CMakeLists.txt to refer to the required components. But main isn't exactly a component or is it? Can I REQUIRE it still?

Re: Component: Include header inside main folder

Posted: Sat May 15, 2021 3:39 pm
by bitmandu
I think you want to add "main" to INCLUDE_DIRS in CMakeLists.txt. This should add the main folder to the global include search path.

For example

Code: Select all

idf_component_register(SRCS ...
                       INCLUDE_DIRS "main" ...
                       REQUIRES ...)