mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-03 03:31:41 +03:00
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 <frantisek.hrbata@espressif.com>
This commit is contained in:
@@ -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}")
|
||||
|
||||
Reference in New Issue
Block a user