From 60e46a1b3f68254401ffce63b15eec172ddcd33b Mon Sep 17 00:00:00 2001 From: Frantisek Hrbata Date: Tue, 20 Jan 2026 16:46:32 +0100 Subject: [PATCH] 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 --- tools/cmakev2/kconfig.cmake | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/cmakev2/kconfig.cmake b/tools/cmakev2/kconfig.cmake index ceda49dbde8..bc944116b85 100644 --- a/tools/cmakev2/kconfig.cmake +++ b/tools/cmakev2/kconfig.cmake @@ -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}")