Chapter 4. API Guides
This uses globbing behind the scenes to find source files in the specified directories. Be aware, however, that if a new
source file is added and this method is used, then CMake won’t know to automatically re-run and this file won’t
be added to the build.
The trade-off is acceptable when you’re adding the file yourself, because you can trigger a clean build or run idf.
py reconfigure to manually re-run CMake. However, the problem gets harder when you share your project
with others who may check out a new version using a source control tool like Git…
For components which are part of ESP-IDF, we use a third party Git CMake integration module
(/tools/cmake/third_party/GetGitRevisionDescription.cmake) which automatically re-runs CMake any time the
repository commit changes. This means if you check out a new ESP-IDF version, CMake will automatically re-
run.
For project components (not part of ESP-IDF), there are a few different options:
• If keeping your project file in Git, ESP-IDF will automatically track the Git revision and re-run CMake if the
revision changes.
• If some components are kept in a third git repository (not the project repository or ESP-IDF repository), you
can add a call to the git_describe function in a component CMakeLists file in order to automatically
trigger re-runs of CMake when the Git revision changes.
• If not using Git, remember to manually run idf.py reconfigure whenever a source file may change.
• To avoid this problem entirely, use SRCS argument to idf_component_register to list all source files
in project components.
The best option will depend on your particular project and its users.
4.4.23 Build System Metadata
For integration into IDEs and other build systems, when CMake runs the build process generates a number of metadata
files in the build/ directory. To regenerate these files, run cmake or idf.py reconfigure (or any other
idf.py build command).
• compile_commands.json is a standard format JSON file which describes every source file which is
compiled in the project. A CMake feature generates this file, and many IDEs know how to parse it.
• project_description.json contains some general information about the ESP-IDF project, configured
paths, etc.
• flasher_args.json contains esptool.py arguments to flash the project’s binary files. There are also
flash_*_args files which can be used directly with esptool.py. See Flash arguments.
• CMakeCache.txt is the CMake cache file which contains other information about the CMake process,
toolchain, etc.
• config/sdkconfig.json is a JSON-formatted version of the project configuration values.
• config/kconfig_menus.json is a JSON-formatted version of the menus shown in menuconfig, for
use in external IDE UIs.
JSON Configuration Server
A tool called confserver.py is provided to allow IDEs to easily integrate with the configuration system logic.
confserver.py is designed to run in the background and interact with a calling process by reading and writing
JSON over process stdin & stdout.
You can run confserver.py from a project via idf.py confserver or ninja confserver, or a similar
target triggered from a different build generator.
For more information about confserver.py, see tools/kconfig_new/README.md.
4.4.24 Build System Internals
Espressif Systems 1295
Submit Document Feedback
Release v4.4