CMake Files not updating after CMakeLists.txt edit


I am using Platformio to build a simple project running on an ESP32. I am using the “new” CMake build system.

When adding a new source file in the src directory, immediately after adding the source file to the CMakeLists.txt file (more specifically the idf_component_register command) and then running platformio run, Platformio updates the CMake files, rebuilds the project and everything works fine.

When adding a new source file in the src directory and then NOT immediately adding the source file to the the CMakeLists.txt and then running platformio run, the linker at the end of the build process obviously complains about undefined references (provided I am referencing some symbol from that new source file somewhere in my code).

However, when I now update my CMakeLists.txt file to include the new source file and invoke platformio run again, the linker still complains about undefined references.

It seems like Platformio is not “updating” its CMake files, when ONLY the contents of the CMakeLists.txt file change.

Is there a command that one can use to force Platformio to update the CMake files. Deleting the hidden .pio directory or manually running CMake does not seem to be the most elegant solution.

I am using:
Ubuntu @ 18.4.4
Platformio Core @ 4.3.1
Espressif 32 @ 1.12.0

Thank you for any advice

Bug reports for PIO’s ESP32 ESP-IDF build system integration to Issues · platformio/platform-espressif32 · GitHub please, otherwise they may drown in the mass of other posts in the community forum.