'Making CMake compile more than 1 source file instead of just the main source file (Similar to .ino of arduino) for code clarity

I've got a piece of code in C in the main.c file of my program which is for embedded ESP 32 in ESP-IDF for context, and I'd like to cut and move some of the code like global variables callback functions definitions etc to other files like init.c, my_functions.c etc without creating a special library with header file and using 3include<lib.h> similar to how you can do it in arduino with ino files.

Is such a thing possible with CMake or ESP-IDF?

c


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source