From 50876225a32e6c0d90d2cde7a425687bbf8f618a Mon Sep 17 00:00:00 2001 From: Frantisek Hrbata Date: Mon, 19 Jan 2026 09:11:01 +0100 Subject: [PATCH] fix(cmakev2/component): use component interface in dependency chain The dependency chain currently tracks component names that are included recursively with `idf_component_include`. However, these component names can be ambiguous because a component may be referenced by different names, such as with a namespace. Additionally, `idf_component_include` can accept anything that `__get_component_interface` accepts, meaning even the component interface target can be used to include the component in the build. To uniquely identify each component, use component interface targets instead of names in the dependency chain. Signed-off-by: Frantisek Hrbata --- tools/cmakev2/component.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/cmakev2/component.cmake b/tools/cmakev2/component.cmake index b38680cc993..08a9ca5c67c 100644 --- a/tools/cmakev2/component.cmake +++ b/tools/cmakev2/component.cmake @@ -885,12 +885,12 @@ function(idf_component_include name) # helps in detecting and reporting circular dependencies, such as # C1->C2->C1. In this scenario, C2 can still use the C1 interface target, # but C1 will only be fully evaluated after C2 has been evaluated. - if("${component_name}" IN_LIST __DEPENDENCY_CHAIN) - idf_dbg("Component '${name}' in circular dependency chain '${__DEPENDENCY_CHAIN}'") + if("${component_interface}" IN_LIST __DEPENDENCY_CHAIN) + idf_dbg("Component '${component_interface}' in circular dependency chain '${__DEPENDENCY_CHAIN}'") return() endif() - list(APPEND __DEPENDENCY_CHAIN "${name}") + list(APPEND __DEPENDENCY_CHAIN "${component_interface}") # Evaluate the CMakeLists.txt file of the component. idf_component_get_property(component_build_dir "${component_name}" COMPONENT_BUILD_DIR) add_subdirectory("${component_directory}" "${component_build_dir}")