Library Include Specificity

Simple issue, we would like to ensure that my local libraries can be easily included with the level of specificity that we would like.

For example with this project Structure:

/libs
+ Lib_A
+ + Header_A.h
+ + Header_A.cpp
+ Lib_B
+ + Header_B.h
+ + Header_B.cpp

That includes would look like this:

#include <Lib_A/Header_A.h>
#include <Lib_B/Header_B.h>

This is because we are planning on a fairly large project, where some components in the lib folder are already depending on other components therein (Generic Runtime provided to us and ported to our MCU by a third party to ease our development workload as well as some other internal components that would be in that folder).

Is that at all possible in any way? If so, how?

If both Lib_A and Lib_B are in the standard lib/ folder of the project (not libs/), then #include <Header_A.h> works directly, since each detected library dependency will be added to the include path (so e.g., lib/Lib_A).

In contrast, #include <Lib_A/Header_A.h> will not work with a standard configuration because the lib/ folder itself is not added to the include path. A build_flags = -Ilib in the platformio.ini would solve that.

Could you give me some further info on build_flags = -Ilib? I can’t seem to find any thing regarding that flag in the docs, but that would solve our issues if I can get it to work.

You’ll find the description here:

https://docs.platformio.org/en/latest/projectconf/sections/env/options/build/build_flags.html#scopes-scons-variables

Alright, thank you both.

I ended up having to use it as -I"lib" instead, likely due to being on linux.