From c5f85f8275c0a5ac598ff7be69dac9f843c39b4d Mon Sep 17 00:00:00 2001 From: wangchengdong Date: Wed, 19 Nov 2025 20:56:34 +0800 Subject: [PATCH] CMake: Enable Kconfig generation for external directories Currently, nuttx_generate_kconfig() can only parse subdirectories under apps/. This patch extends its capability to also parse external directories referenced from the apps tree. Signed-off-by: Chengdong Wang --- cmake/nuttx_kconfig.cmake | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/cmake/nuttx_kconfig.cmake b/cmake/nuttx_kconfig.cmake index 085cbf1c0ca..923b2a03d67 100644 --- a/cmake/nuttx_kconfig.cmake +++ b/cmake/nuttx_kconfig.cmake @@ -117,6 +117,8 @@ function(nuttx_generate_kconfig) nuttx_generate_kconfig ONE_VALUE MENUDESC + MULTI_VALUE + EXTERNAL_DIRECTORIES REQUIRED ARGN ${ARGN}) @@ -143,12 +145,21 @@ function(nuttx_generate_kconfig) LIST_DIRECTORIES false ${CMAKE_CURRENT_LIST_DIR} ${CMAKE_CURRENT_LIST_DIR}/*/CMakeLists.txt) + if(NOT MENUDESC) + set(EXTERNAL_CMAKESCRIPTS) + foreach(external_dir ${EXTERNAL_DIRECTORIES}) + if(EXISTS ${external_dir}/CMakeLists.txt) + list(APPEND EXTERNAL_CMAKESCRIPTS "${external_dir}/CMakeLists.txt") + endif() + endforeach() + endif() + # we need to recursively generate the Kconfig menus of multi-level # directories. # # when generating a Kconfig file for the current directory, it should include # and invoke all the Kconfig files gathered from its subdirectories. - foreach(SUB_CMAKESCRIPT ${SUB_CMAKESCRIPTS}) + foreach(SUB_CMAKESCRIPT ${SUB_CMAKESCRIPTS} ${EXTERNAL_CMAKESCRIPTS}) string(REPLACE "CMakeLists.txt" "Kconfig" SUB_KCONFIG ${SUB_CMAKESCRIPT}) string(REPLACE "/" "_" MENUCONFIG ${SUB_KCONFIG}) if(WIN32)