diff --git a/cmake/modules/extensions.cmake b/cmake/modules/extensions.cmake index 2573dbd2e52..90b4089b011 100644 --- a/cmake/modules/extensions.cmake +++ b/cmake/modules/extensions.cmake @@ -1461,9 +1461,13 @@ function(import_kconfig prefix kconfig_fragment) list(APPEND keys "${CONF_VARIABLE_NAME}") endforeach() - foreach(outvar ${ARGN}) - set(${outvar} "${keys}" PARENT_SCOPE) - endforeach() + if(ARGC GREATER 2) + if(ARGC GREATER 3) + # Two mandatory arguments and one optional, anything after that is an error. + message(FATAL_ERROR "Unexpected argument after '': import_kconfig(... ${ARGV3})") + endif() + set(${ARGV2} "${keys}" PARENT_SCOPE) + endif() endfunction() ########################################################