Need include_extra_dirs guidance for esp-mdf libs

I am trying to include esp-mdf libs in my project. These are installed in ~/esp/esp-mdf/components. The directory structure is like this:

- components
  - mcommon
    - *.c
    - include
      - *.h
  - ...

I have added ~/esp/esp-mdf/components/mcommon, ... to the lib_extra_dirs configuration in platformio.ini. Which kinda works. The compiler is able to find the header files, however, the implementation cannot be found.

In the docs, it is mentioned that the path should be a storage path that includes subfolders for the libraries, which is now kind of done with those “include” folders. This is also visible in the dependency tree during compile, which just says

Dependency Graph
|-- <include>
|   |-- <include>
|-- <include>

The problem when compiling is that the implementation cannot be found.

When I instead point lib_extra_dirs to ~/esp/esp-mdf/components (and not the individual component folders inside), the compiler is not able to find the header files

What is the way to work with .h and .c files in different folder levels?

The right solution is to add esp-mdf to lib folder of a project, then add library.json and configure its buidl->flags field.