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.