Просмотр исходного кода

docs: update CN translation for build-system.rst

Shang Zhou 3 лет назад
Родитель
Сommit
256c8a103e
2 измененных файлов с 19 добавлено и 2 удалено
  1. 2 2
      docs/en/api-guides/build-system.rst
  2. 17 0
      docs/zh_CN/api-guides/build-system.rst

+ 2 - 2
docs/en/api-guides/build-system.rst

@@ -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::
 

+ 17 - 0
docs/zh_CN/api-guides/build-system.rst

@@ -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:
 
 覆盖项目的部分设置