How to Add Components to ESP32 CMake Project File

To add a new component to your CMake Project to build for ESP32 program, follow the following steps.

Remember components are libraries that you write outside of the main.c source file.

Find the CMakeLists.txt file in the same directory as your component’s header and source file located. Add the name of the “.c” file in the idf_component_register as shown in the image above.

Rerun the build and you should have a successful addition of a new component.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: