From f8d0c5770b076d9418e2bf5e74eafadabe624816 Mon Sep 17 00:00:00 2001 From: Renz Bagaporo Date: Thu, 2 Apr 2020 21:57:48 +0800 Subject: [PATCH] cmake: take note of component overriden dir --- docs/en/api-guides/build-system.rst | 3 +++ tools/cmake/component.cmake | 3 +++ 2 files changed, 6 insertions(+) diff --git a/docs/en/api-guides/build-system.rst b/docs/en/api-guides/build-system.rst index f5d7a6f8b5..3fdc0284eb 100644 --- a/docs/en/api-guides/build-system.rst +++ b/docs/en/api-guides/build-system.rst @@ -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` - 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 diff --git a/tools/cmake/component.cmake b/tools/cmake/component.cmake index b9b035bc50..b5b7e3ae9c 100644 --- a/tools/cmake/component.cmake +++ b/tools/cmake/component.cmake @@ -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})