diff --git a/cmake/modules/extensions.cmake b/cmake/modules/extensions.cmake index 371bc4cac17..50edddcb600 100644 --- a/cmake/modules/extensions.cmake +++ b/cmake/modules/extensions.cmake @@ -2291,26 +2291,27 @@ endfunction() # # returns an updated list of absolute paths # -# CONF_FILES : Find all configuration files in path and return them in a -# list. Configuration files will be: -# - DTS: Overlay files (.overlay) -# - Kconfig: Config fragments (.conf) -# The conf file search will return existing configuration -# files for the current board. -# CONF_FILES takes the following additional arguments: -# BOARD : Find configuration files for specified board. -# BOARD_REVISION : Find configuration files for specified board -# revision. Requires BOARD to be specified. +# CONF_FILES : Find all configuration files in the list of paths and +# return them in a list. If paths is empty then no configuration +# files are returned. Configuration files will be: +# - DTS: Overlay files (.overlay) +# - Kconfig: Config fragments (.conf) +# The conf file search will return existing configuration +# files for the current board. +# CONF_FILES takes the following additional arguments: +# BOARD : Find configuration files for specified board. +# BOARD_REVISION : Find configuration files for specified board +# revision. Requires BOARD to be specified. # -# If no board is given the current BOARD and -# BOARD_REVISION will be used. +# If no board is given the current BOARD and +# BOARD_REVISION will be used. # -# DTS : List to append DTS overlay files in to -# KCONF : List to append Kconfig fragment files in to -# BUILD : Build type to include for search. -# For example: -# BUILD debug, will look for _debug.conf -# and _debug.overlay, instead of .conf +# DTS : List to append DTS overlay files in to +# KCONF : List to append Kconfig fragment files in to +# BUILD : Build type to include for search. +# For example: +# BUILD debug, will look for _debug.conf +# and _debug.overlay, instead of .conf # function(zephyr_file) set(file_options APPLICATION_ROOT CONF_FILES) @@ -2322,10 +2323,11 @@ Please provide one of following: APPLICATION_ROOT, CONF_FILES") if(${ARGV0} STREQUAL APPLICATION_ROOT) set(single_args APPLICATION_ROOT) 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() - cmake_parse_arguments(FILE "" "${single_args}" "" ${ARGN}) + cmake_parse_arguments(FILE "" "${single_args}" "${multi_args}" ${ARGN}) if(FILE_UNPARSED_ARGUMENTS) message(FATAL_ERROR "zephyr_file(${ARGV0} ...) given unknown arguments: ${FILE_UNPARSED_ARGUMENTS}") endif() @@ -2397,10 +2399,12 @@ Relative paths are only allowed with `-D${ARGV1}=`") list(REMOVE_DUPLICATES filename_list) if(FILE_DTS) - foreach(filename ${filename_list}) - if(EXISTS ${FILE_CONF_FILES}/${filename}.overlay) - list(APPEND ${FILE_DTS} ${FILE_CONF_FILES}/${filename}.overlay) - endif() + foreach(path ${FILE_CONF_FILES}) + foreach(filename ${filename_list}) + if(EXISTS ${path}/${filename}.overlay) + list(APPEND ${FILE_DTS} ${path}/${filename}.overlay) + endif() + endforeach() endforeach() # This updates the provided list in parent scope (callers scope) @@ -2408,10 +2412,12 @@ Relative paths are only allowed with `-D${ARGV1}=`") endif() if(FILE_KCONF) - foreach(filename ${filename_list}) - if(EXISTS ${FILE_CONF_FILES}/${filename}.conf) - list(APPEND ${FILE_KCONF} ${FILE_CONF_FILES}/${filename}.conf) - endif() + foreach(path ${FILE_CONF_FILES}) + foreach(filename ${filename_list}) + if(EXISTS ${path}/${filename}.conf) + list(APPEND ${FILE_KCONF} ${path}/${filename}.conf) + endif() + endforeach() endforeach() # This updates the provided list in parent scope (callers scope)