PlatformIO can`t find library headers after ESP32 dev-platform 1.12.0 update

Hi,

I’ve just updated to Espressif 32 development platform 1.12.0 from 1.11.0 and when building my project PlatformIO can’t find header files from the “lib” directory. This was working fine in the previous version. I’m doing exactly what the lib/README says.

Plarform: ESP-IDF
Error: src\main.c:3:10: fatal error: Foo.h: No such file or directory

My file structure:

    |--lib
    |  |--Foo
    |  |  |- Foo.c
    |  |  |- Foo.h
    |--src
       |- main.c

Content of main.c

#include <Foo.h>
void app_main() {
    foo();
}

Content of Foo.h

void foo();

Content of Foo.c

#include <stdio.h>
void foo() {
    printf("hello");
}

My small test project the can be used to reproduce the issue.
https://github.com/guwerdo/pio-test

I suspect the issue is related to this description in the Espressif 32 dev-platform 1.12.0 release notes. But I can’t figure out where to put my library source codes in this new structure.

Starting with this release the build script for ESP-IDF framework uses CMake code model as the source of build configuration (old configuration methods using sdkconfig.h or build flags in platformio.ini are deprecated).

Reminds me of discussions in Private Lib not found since latest update - #2 by valeros and LDF does not find headers from projects in top level lib folder.

@valeros, do normal lib/ folders in ESP-IDF v4 projects not work anymore and must be declared via idf_component_register in the CMakeLists.txt, or is this is a bug in the LDF?

Thanks!
The Private Lib not found since latest update topic helped to resolve the issue.

I renamed the lib folder to components and added a CMakeLists.txt file with the following content:
idf_component_register(SRCS "foo.c" INCLUDE_DIRS ".")

Then I added the following line to the CMakeLists.txt next to the plarformio.ini file:
list(APPEND EXTRA_COMPONENT_DIRS components/foo)