docs: update CN translation for build-system.rst

This commit is contained in:
Shang Zhou 2022-11-04 15:55:31 +08:00 committed by Ivan Grokhotkov
parent d89652b382
commit 256c8a103e
No known key found for this signature in database
GPG Key ID: 1E050E141B280628
2 changed files with 19 additions and 2 deletions

View File

@ -605,12 +605,12 @@ 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
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's better to use the ``PRIV_REQUIRES`` feature in ``idf_component_register`` to create a dependency. However in some cases it's necessary 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`).
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::

View File

@ -605,6 +605,23 @@ CMake 通常会在链接器命令行上重复两次组件库名称来自动处
- 项目导入 :ref:`project_include.cmake` 文件的顺序。
- 生成用于编译(通过 ``-I`` 参数)的头文件路径列表的顺序。请注意,对于给定组件的源文件,仅需将该组件的依赖组件的头文件路径告知编译器。
添加链接时依赖项
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. highlight:: cmake
ESP-IDF 的 CMake 辅助函数 ``idf_component_add_link_dependency`` 可以在组件之间添加仅作用于链接时的依赖关系。绝大多数情况下,我们都建议您使用 ``idf_component_register`` 中的 ``PRIV_REQUIRES`` 功能来构建依赖关系。然而在某些情况下,还是有必要添加另一个组件对当前组件的链接时依赖,即反转 ``PRIV_REQUIRES`` 中的依赖关系(参考示例::doc:`/api-reference/storage/spi_flash_override_driver`)。
要使另一个组件在链接时依赖于这个组件::
idf_component_add_link_dependency(FROM other_component)
请将上述行置于 ``idf_component_register`` 行之后。
也可以通过名称指定两个组件::
idf_component_add_link_dependency(FROM other_component TO that_component)
.. _override_project_config:
覆盖项目的部分设置