You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/en/api-guides/build-system.rst
+26-4Lines changed: 26 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -307,7 +307,14 @@ When CMake runs to configure the project, it logs the components included in the
307
307
Multiple Components with the Same Name
308
308
--------------------------------------
309
309
310
-
When ESP-IDF is collecting all the components to compile, it will do this in the order specified by ``COMPONENT_DIRS``; by default, this means ESP-IDF's internal components first (``IDF_PATH/components``), then any components in directories specified in ``EXTRA_COMPONENT_DIRS``, and finally the project's components (``PROJECT_DIR/components``). If two or more of these directories contain component sub-directories with the same name, the component in the last place searched is used. This allows, for example, overriding ESP-IDF components with a modified version by copying that component from the ESP-IDF components directory to the project components directory and then modifying it there. If used in this way, the ESP-IDF directory itself can remain untouched.
310
+
When ESP-IDF is collecting all the components to compile, the search precedence is as follows (from highest to lowest):
311
+
312
+
* Project components
313
+
* Components from ``EXTRA_COMPONENT_DIRS``
314
+
* Project managed components, downloaded by the IDF Component Manager into ``PROJECT_DIR/managed_components``, unless the IDF Component Manager is disabled.
315
+
* ESP-IDF components (``IDF_PATH/components``)
316
+
317
+
If two or more of these directories contain component sub-directories with the same name, the component with higher precedence is used. This allows, for example, overriding ESP-IDF components with a modified version by copying that component from the ESP-IDF components directory to the project components directory and then modifying it there. If used in this way, the ESP-IDF directory itself can remain untouched.
311
318
312
319
.. note::
313
320
@@ -1257,12 +1264,26 @@ Set a :ref:`build property <cmake-build-properties>` *property* with value *val*
Present a directory *component_dir* that contains a component to the build system. Relative paths are converted to absolute paths with respect to current directory.
1263
-
All calls to this command must be performed before `idf_build_process`.
1264
1270
1265
-
This command does not guarantee that the component will be processed during build (see the `COMPONENTS` argument description for `idf_build_process`)
1271
+
An optional *component_source* argument can be specified to indicate the source of the component. (default: "project_components")
1272
+
1273
+
This argument determines the overriding priority for components with the same name. For detailed information, see :ref:`cmake-components-same-name`.
1274
+
1275
+
This argument supports the following values (from highest to lowest priority):
1276
+
1277
+
- "project_components" - project components
1278
+
- "project_extra_components" - components from ``EXTRA_COMPONENT_DIRS``
1279
+
- "project_managed_components" - custom project dependencies managed by the IDF Component Manager
1280
+
- "idf_components" - ESP-IDF built-in components, typically under :idf:`/components`
1281
+
1282
+
For instance, if a component named "json" is present as both "idf_components", and "project_components", the component as "project_components" takes precedence over the one as "idf_components".
1283
+
1284
+
.. warning::
1285
+
1286
+
All calls to this command must be performed before `idf_build_process`. This command does not guarantee that the component will be processed during build (see the `COMPONENTS` argument description for `idf_build_process`).
1266
1287
1267
1288
.. code-block:: none
1268
1289
@@ -1422,6 +1443,7 @@ These are properties that describe a component. Values of component properties c
1422
1443
- COMPONENT_LIB - name for created component static/interface library; set by ``idf_build_component`` and library itself is created by ``idf_component_register``
1423
1444
- COMPONENT_NAME - name of the component; set by ``idf_build_component`` based on the component directory name
1424
1445
- COMPONENT_TYPE - type of the component, whether LIBRARY or CONFIG_ONLY. A component is of type LIBRARY if it specifies source files or embeds a file
1446
+
- COMPONENT_SOURCE - source of the component, one of "idf_components", "project_managed_components", "project_components", "project_extra_components". This is used to determine the override precedence of components with the same name.
1425
1447
- EMBED_FILES - list of files to embed in component; set from ``idf_component_register`` EMBED_FILES argument
1426
1448
- EMBED_TXTFILES - list of text files to embed in component; set from ``idf_component_register`` EMBED_TXTFILES argument
1427
1449
- INCLUDE_DIRS - list of component include directories; set from ``idf_component_register`` INCLUDE_DIRS argument
0 commit comments