fix(cmakev2/compat): display empty components as excluded into menuconfig

Some components simply return when included in a build for the Linux
target. This is silently ignored in the `idf_component_include`, and the
component interface target is linked as requirement in
`idf_component_register`. This has the side
effect of such components being reported as included, with their
configuration displayed in the menuconfig for included components,
rather than in the submenu for excluded components. For example, the
`bt` component, if added as a dependency in `idf_component_register`,
will be displayed in menuconfig as an included component for Linux
target. The `idf_component_include` function sets the component's
`COMPONENT_REAL_TARGET` property to `NOTFOUND` in such situations. Use
this information when config.env is generated put such components into
excluded submenu. Note that we cannot avoid linking empty component interface
into library, because there might be recursive dependencies and at the
time when the component is included we might not now if it has a real
target or not.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
This commit is contained in:
Frantisek Hrbata
2026-01-20 16:46:32 +01:00
parent 82a063957a
commit 60e46a1b3f

View File

@@ -407,9 +407,10 @@ function(__create_executable_config_env_file executable)
foreach(component_interface IN LISTS component_interfaces)
__idf_component_get_property_unchecked(component_kconfig "${component_interface}" __KCONFIG)
__idf_component_get_property_unchecked(component_projbuild "${component_interface}" __KCONFIG_PROJBUILD)
__idf_component_get_property_unchecked(component_real_target "${component_interface}" COMPONENT_REAL_TARGET)
if(component_kconfig)
if("${component_interface}" IN_LIST component_interfaces_linked)
if("${component_interface}" IN_LIST component_interfaces_linked AND component_real_target)
list(APPEND kconfigs "${component_kconfig}")
else()
list(APPEND kconfigs_excluded "${component_kconfig}")
@@ -417,7 +418,7 @@ function(__create_executable_config_env_file executable)
endif()
if(component_projbuild)
if("${component_interface}" IN_LIST component_interfaces_linked)
if("${component_interface}" IN_LIST component_interfaces_linked AND component_real_target)
list(APPEND kconfigs_projbuild "${component_projbuild}")
else()
list(APPEND kconfigs_projbuild_excluded "${component_projbuild}")