cmake: take note of component overriden dir

This commit is contained in:
Renz Bagaporo 2020-04-02 21:57:48 +08:00
parent d93b8b2939
commit f8d0c5770b
2 changed files with 6 additions and 0 deletions

View file

@ -308,6 +308,8 @@ The list of directories in ``COMPONENT_DIRS`` is searched for the project's comp
When CMake runs to configure the project, it logs the components included in the build. This list can be useful for debugging the inclusion/exclusion of certain components.
.. _cmake-components-same-name:
Multiple components with the same name
--------------------------------------
@ -1313,6 +1315,7 @@ For example, to get the directory of the ``freertos`` component:
- COMPONENT_ALIAS - alias for COMPONENT_LIB used for linking the component to external targets; set by ``idf_build_component`` and alias library itself
is created by ``idf_component_register``
- COMPONENT_DIR - component directory; set by ``idf_build_component``
- COMPONENT_OVERRIDEN_DIR - contains the directory of the original component if ref:`this component overrides another component<cmake-components-same-name>`
- COMPONENT_LIB - name for created component static/interface library; set by ``idf_build_component`` and library itself
is created by ``idf_component_register``
- COMPONENT_NAME - name of the component; set by ``idf_build_component`` based on the component directory name

View file

@ -171,6 +171,9 @@ function(__component_add component_dir prefix)
add_library(${component_target} STATIC IMPORTED)
endif()
idf_build_set_property(__COMPONENT_TARGETS ${component_target} APPEND)
else()
__component_get_property(dir ${component_target} COMPONENT_DIR)
__component_set_property(${component_target} COMPONENT_OVERRIDEN_DIR ${dir})
endif()
set(component_lib __${prefix}_${component_name})