mirror of
https://github.com/apache/nuttx.git
synced 2026-05-30 21:36:28 +08:00
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 <wangchengdong@lixiang.com>
This commit is contained in:
@@ -117,6 +117,8 @@ function(nuttx_generate_kconfig)
|
|||||||
nuttx_generate_kconfig
|
nuttx_generate_kconfig
|
||||||
ONE_VALUE
|
ONE_VALUE
|
||||||
MENUDESC
|
MENUDESC
|
||||||
|
MULTI_VALUE
|
||||||
|
EXTERNAL_DIRECTORIES
|
||||||
REQUIRED
|
REQUIRED
|
||||||
ARGN
|
ARGN
|
||||||
${ARGN})
|
${ARGN})
|
||||||
@@ -143,12 +145,21 @@ function(nuttx_generate_kconfig)
|
|||||||
LIST_DIRECTORIES false
|
LIST_DIRECTORIES false
|
||||||
${CMAKE_CURRENT_LIST_DIR} ${CMAKE_CURRENT_LIST_DIR}/*/CMakeLists.txt)
|
${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
|
# we need to recursively generate the Kconfig menus of multi-level
|
||||||
# directories.
|
# directories.
|
||||||
#
|
#
|
||||||
# when generating a Kconfig file for the current directory, it should include
|
# when generating a Kconfig file for the current directory, it should include
|
||||||
# and invoke all the Kconfig files gathered from its subdirectories.
|
# 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 "CMakeLists.txt" "Kconfig" SUB_KCONFIG ${SUB_CMAKESCRIPT})
|
||||||
string(REPLACE "/" "_" MENUCONFIG ${SUB_KCONFIG})
|
string(REPLACE "/" "_" MENUCONFIG ${SUB_KCONFIG})
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
|
|||||||
Reference in New Issue
Block a user