cmake: extend zephyr_file(CONF_FILES <paths>) to allow a list of paths
Extend zephyr_file(CONF_FILES <paths>) to take a list of paths to lookup instead of a single path. This remove the need of callers to do: > foreach(p ${paths}) > zephyr_file(CONF_FILES ${p}) > ... > endforeach() and instead allow them to just pass the list directly to > zephyr_file(CONF_FILES ${paths}) In addition the help text is updated with the detail that CONF_FILES can be given an empty list. This has always been possible, but not described. Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
This commit is contained in:
parent
95e81bfcd6
commit
6e32f28a01
1 changed files with 34 additions and 28 deletions
|
@ -2291,8 +2291,9 @@ endfunction()
|
||||||
#
|
#
|
||||||
# returns an updated list of absolute paths
|
# returns an updated list of absolute paths
|
||||||
#
|
#
|
||||||
# CONF_FILES <path>: Find all configuration files in path and return them in a
|
# CONF_FILES <paths>: Find all configuration files in the list of paths and
|
||||||
# list. Configuration files will be:
|
# return them in a list. If paths is empty then no configuration
|
||||||
|
# files are returned. Configuration files will be:
|
||||||
# - DTS: Overlay files (.overlay)
|
# - DTS: Overlay files (.overlay)
|
||||||
# - Kconfig: Config fragments (.conf)
|
# - Kconfig: Config fragments (.conf)
|
||||||
# The conf file search will return existing configuration
|
# The conf file search will return existing configuration
|
||||||
|
@ -2322,10 +2323,11 @@ Please provide one of following: APPLICATION_ROOT, CONF_FILES")
|
||||||
if(${ARGV0} STREQUAL APPLICATION_ROOT)
|
if(${ARGV0} STREQUAL APPLICATION_ROOT)
|
||||||
set(single_args APPLICATION_ROOT)
|
set(single_args APPLICATION_ROOT)
|
||||||
elseif(${ARGV0} STREQUAL CONF_FILES)
|
elseif(${ARGV0} STREQUAL CONF_FILES)
|
||||||
set(single_args CONF_FILES BOARD BOARD_REVISION DTS KCONF BUILD)
|
set(single_args BOARD BOARD_REVISION DTS KCONF BUILD)
|
||||||
|
set(multi_args CONF_FILES)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
cmake_parse_arguments(FILE "" "${single_args}" "" ${ARGN})
|
cmake_parse_arguments(FILE "" "${single_args}" "${multi_args}" ${ARGN})
|
||||||
if(FILE_UNPARSED_ARGUMENTS)
|
if(FILE_UNPARSED_ARGUMENTS)
|
||||||
message(FATAL_ERROR "zephyr_file(${ARGV0} <val> ...) given unknown arguments: ${FILE_UNPARSED_ARGUMENTS}")
|
message(FATAL_ERROR "zephyr_file(${ARGV0} <val> ...) given unknown arguments: ${FILE_UNPARSED_ARGUMENTS}")
|
||||||
endif()
|
endif()
|
||||||
|
@ -2397,22 +2399,26 @@ Relative paths are only allowed with `-D${ARGV1}=<path>`")
|
||||||
list(REMOVE_DUPLICATES filename_list)
|
list(REMOVE_DUPLICATES filename_list)
|
||||||
|
|
||||||
if(FILE_DTS)
|
if(FILE_DTS)
|
||||||
|
foreach(path ${FILE_CONF_FILES})
|
||||||
foreach(filename ${filename_list})
|
foreach(filename ${filename_list})
|
||||||
if(EXISTS ${FILE_CONF_FILES}/${filename}.overlay)
|
if(EXISTS ${path}/${filename}.overlay)
|
||||||
list(APPEND ${FILE_DTS} ${FILE_CONF_FILES}/${filename}.overlay)
|
list(APPEND ${FILE_DTS} ${path}/${filename}.overlay)
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
# This updates the provided list in parent scope (callers scope)
|
# This updates the provided list in parent scope (callers scope)
|
||||||
set(${FILE_DTS} ${${FILE_DTS}} PARENT_SCOPE)
|
set(${FILE_DTS} ${${FILE_DTS}} PARENT_SCOPE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(FILE_KCONF)
|
if(FILE_KCONF)
|
||||||
|
foreach(path ${FILE_CONF_FILES})
|
||||||
foreach(filename ${filename_list})
|
foreach(filename ${filename_list})
|
||||||
if(EXISTS ${FILE_CONF_FILES}/${filename}.conf)
|
if(EXISTS ${path}/${filename}.conf)
|
||||||
list(APPEND ${FILE_KCONF} ${FILE_CONF_FILES}/${filename}.conf)
|
list(APPEND ${FILE_KCONF} ${path}/${filename}.conf)
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
# This updates the provided list in parent scope (callers scope)
|
# This updates the provided list in parent scope (callers scope)
|
||||||
set(${FILE_KCONF} ${${FILE_KCONF}} PARENT_SCOPE)
|
set(${FILE_KCONF} ${${FILE_KCONF}} PARENT_SCOPE)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue