cmake: pass exclusion list to nuttx_add_subdirectory
Introduce support in CMake to ignore specific directories added by `nuttx_add_subdirectory()`. This provides more flexibility for build configuration and allows excluding unwanted or optional components. * Improves modularity of project configuration. Signed-off-by: trns1997 <trns1997@gmail.com>
This commit is contained in:
parent
ae5a6005dc
commit
81e79d9a65
1 changed files with 16 additions and 0 deletions
|
|
@ -21,6 +21,14 @@
|
||||||
# ##############################################################################
|
# ##############################################################################
|
||||||
|
|
||||||
function(nuttx_add_subdirectory)
|
function(nuttx_add_subdirectory)
|
||||||
|
# Parse arguments: EXCLUDE can be a list of directories
|
||||||
|
set(options)
|
||||||
|
set(oneValueArgs)
|
||||||
|
set(multiValueArgs EXCLUDE)
|
||||||
|
cmake_parse_arguments(NUTTX "${options}" "${oneValueArgs}"
|
||||||
|
"${multiValueArgs}" ${ARGN})
|
||||||
|
|
||||||
|
# Find all subdirs that have a CMakeLists.txt
|
||||||
file(
|
file(
|
||||||
GLOB subdir
|
GLOB subdir
|
||||||
LIST_DIRECTORIES false
|
LIST_DIRECTORIES false
|
||||||
|
|
@ -29,6 +37,14 @@ function(nuttx_add_subdirectory)
|
||||||
|
|
||||||
foreach(dir ${subdir})
|
foreach(dir ${subdir})
|
||||||
get_filename_component(dir ${dir} DIRECTORY)
|
get_filename_component(dir ${dir} DIRECTORY)
|
||||||
|
|
||||||
|
# Skip excluded directories
|
||||||
|
list(FIND NUTTX_EXCLUDE ${dir} _skip_index)
|
||||||
|
if(_skip_index GREATER -1)
|
||||||
|
message(STATUS "nuttx_add_subdirectory: Skipping ${dir}")
|
||||||
|
continue()
|
||||||
|
endif()
|
||||||
|
|
||||||
add_subdirectory(${dir})
|
add_subdirectory(${dir})
|
||||||
endforeach()
|
endforeach()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue