Merge branch 'feature/spiflash_override_cmake_function' into 'master'

build system: Add spi_flash_add_link_dependency function for spi_flash custom driver

Closes IDF-3167

See merge request espressif/esp-idf!14186
This commit is contained in:
Ivan Grokhotkov
2022-12-19 22:21:40 +08:00
5 changed files with 78 additions and 6 deletions

View File

@@ -605,6 +605,23 @@ The order of components in the ``BUILD_COMPONENTS`` variable determines other or
- Order that :ref:`project_include.cmake` files are included into the project.
- Order that the list of header paths is generated for compilation (via ``-I`` argument). (Note that for a given component's source files, only that component's dependency's header paths are passed to the compiler.)
Adding Link-Time Dependencies
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. highlight:: cmake
The ESP-IDF CMake helper function ``idf_component_add_link_dependency`` adds a link-only dependency between one component and another. In almost all cases, it is better to use the ``PRIV_REQUIRES`` feature in ``idf_component_register`` to create a dependency. However, in some cases, it's necessary to add the link-time dependency of another component to this component, i.e., the reverse order to ``PRIV_REQUIRES`` (for example: :doc:`/api-reference/storage/spi_flash_override_driver`).
To make another component depend on this component at link time::
idf_component_add_link_dependency(FROM other_component)
Place this line after the line with ``idf_component_register``.
It's also possible to specify both components by name::
idf_component_add_link_dependency(FROM other_component TO that_component)
.. _override_project_config:
Overriding Parts of the Project