ESP32 src_filter -> CMakeLists.txt

Hello,

I’m trying to exclude specific files and directories in the src-directory from the build.
PlatformIO has the ability to use the ‘src_filter’, but not when using esp32 as target (states at least the docu, I also tried it and it does not work…

See here:
https://docs.platformio.org/en/latest/frameworks/espidf.html

The src_filter option cannot be used. It’s done to preserve compatibility with existing ESP-IDF projects. List of source files is specified in the project CMakeLists.txt file.

But in my Project there is no CMakeLists.txt, so I just tried to create one in the src folder and put this line into the file:
add_subdirectory(diretorytoexclude [EXCLUDE_FROM_ALL])
As I expected, this does not work.

It does also not work if I put a CMakeLists.txt in the project folder and use this line:
add_subdirectory(src/diretorytoexclude [EXCLUDE_FROM_ALL])

Does anybody have an idea how I could add CMakeLists.txt file and get it working?

Dave

CMakeLists.txt file only exists for projects using framework = espidf. If you are using Arduino, this does not apply to your and you can work with a normal src_filter. What is your platformio.ini?

@maxgerhardt Thank you for your reply.
This makes it clear.
i tried the src_filter with a -<src/testdir/> which of course not worked, removing the src/ makes it working.
Thank you!