esp-idf/examples/build_system/cmake/component_manager
Djordje Nedic facab8c5a7 tools: Increase the minimal supported CMake version to 3.16
This updates the minimal supported version of CMake to 3.16, which in turn enables us to use more CMake features and have a cleaner build system.
This is the version that provides most new features and also the one we use in our latest docker image for CI.
2022-06-01 06:35:02 +00:00
..
main managed components: fix version references to allow implicit updates according to semver 2022-03-11 13:49:26 +07:00
CMakeLists.txt tools: Increase the minimal supported CMake version to 3.16 2022-06-01 06:35:02 +00:00
README.md examples: Add the component manager example 2021-08-30 13:23:23 +02:00

Using the component manager for downloading dependencies

This example demonstrates how to use IDF Component Manager for downloading dependencies from the component registry. More details and use cases of IDF Component Manager can be found in the programming guide under API Guides -> Tools -> IDF Component Manager.

How to use the example

Hardware Required

This example is designed to work with any commonly available development kit.

Build and Flash

Run idf.py reconfigure to configure this project. During CMake execution the component manager will process data from the manifest file ./main/idf_component.yml where 2 dependencies are defined:

  • idf: ">=4.1" - Specifies required version of ESP-IDF.
  • example/cmp: ">=3.3.3" - Defines dependency on example/cmp component that is used by the main component.

CMake Output:

...
Solving dependencies requirements
Updating lock file at /home/user/esp-idf/examples/build_system/cmake/component_manager/dependencies.lock
Processing 2 dependencies:
[1/2] example/cmp
[2/2] idf
...

Content of the ./managed_components directory after successful build:

> find  ./managed_components
./managed_components
./managed_components/example__cmp
./managed_components/example__cmp/include
./managed_components/example__cmp/include/cmp.h
./managed_components/example__cmp/LICENSE
./managed_components/example__cmp/README.md
./managed_components/example__cmp/CMakeLists.txt
./managed_components/example__cmp/changelog.md
./managed_components/example__cmp/cmp.c
./managed_components/example__cmp/idf_component.yml

Flash the project and run the serial monitor to view the output:

idf.py -p PORT flash monitor

Example Output

The example outputs a line from the cmp_hello function from the component downloaded by the component manager.

Hello from example component!