feat(cmakev2/compat): link common components in idf_component_register

Automatically link commonly required components to the component target
created in the idf_component_register function. This is still necessary
even in cmakev2, as existing components depend on this behavior.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
This commit is contained in:
Frantisek Hrbata
2025-08-20 16:24:28 +02:00
committed by BOT
parent bede750fcd
commit d9eb78c1fd
+5
View File
@@ -253,6 +253,11 @@ function(idf_component_register)
__get_compile_options(OUTPUT compile_options)
add_compile_options("${compile_options}")
idf_build_get_property(common_component_interfaces __COMMON_COMPONENT_INTERFACES)
idf_component_get_property(component_interface "${COMPONENT_NAME}" COMPONENT_INTERFACE)
list(REMOVE_ITEM common_component_interfaces ${component_interface})
link_libraries(${common_component_interfaces})
__get_absolute_paths(PATHS "${ARG_INCLUDE_DIRS}" BASE_DIR "${COMPONENT_DIR}" OUTPUT include_dirs)
__get_absolute_paths(PATHS "${ARG_PRIV_INCLUDE_DIRS}" BASE_DIR "${COMPONENT_DIR}" OUTPUT priv_include_dirs)
foreach(dir IN LISTS include_dirs priv_include_dirs)