My intention is to keep all product-specific configuration header files in a single directory, for example, in the 'main/include' directory. I have several reusable (not product-specific) components that need to access these header files. I did not find any hint in the documentation about how to specify a global include directory for the project. Apparently, 'main/include' is not included in the component. Adding 'main' to the REQUIRES section seems to be not the correct way. Creating a Kconfig.projbuild may do the trick, but it is a lot of work for all parameters, and actually these config parameters are fixed for a product, not editable.
I had the same problem with some ESP-IDF libraries, like NimBLE and TinyUSB. I wanted to specify my own settings, but could not figure out how to do it without editing the component files.
I'd appreciate any help.
Thanks,
Zoltan
How to specify a global include directory for all components?
-
- Posts: 11
- Joined: Tue Apr 12, 2022 11:15 am
-
- Posts: 11
- Joined: Tue Apr 12, 2022 11:15 am
Re: How to specify a global include directory for all components?
I have figured it out. Add
to the CMakeList.txt in the project's root directory, right before:
Code: Select all
include_directories(${CMAKE_CURRENT_LIST_DIR}/main/include)
Code: Select all
project(${ProjectId})
-
- Posts: 11
- Joined: Tue Apr 12, 2022 11:15 am
Re: How to specify a global include directory for all components?
Now, how to do the same for ULP-RISCV components? Apparently the method above does not work with the RISCV compiler.
-
- Posts: 9766
- Joined: Thu Nov 26, 2015 4:08 am
Re: How to specify a global include directory for all components?
Possibly a cleaner way (that might also work with ULP, I don't know) is to make those shared things into its own header-only component, then use EXTRA_COMPONENT_DIRS in the projects to point to that an REQUIRES in the components that need it?
-
- Posts: 11
- Joined: Tue Apr 12, 2022 11:15 am
Re: How to specify a global include directory for all components?
That seems to be a nicer solution indeed. However, then you'd need to add this component to all the components explicitly. While I could do it for my own components, it does not work with system or managed components like NimBLE or TinyUSB, I believe. On the other hand, the "include_directories" method adds this folder to all the components' include path.
Who is online
Users browsing this forum: No registered users and 161 guests