Skip to content

Commit 430370c

Browse files
tejlmandstephanosio
authored andcommitted
cmake: fix <keys> argument in import_kconfig()
The signature of import_kconfig() take two mandatory arguments and one optional: > import_kconfig(<prefix> <kconfig_fragment> [<keys>]) but has been implemented in such a way that it loops all arguments after the two mandatory args and sets the same list on those. Fix this error by only setting the created variables on the third and optional argument if it exists. Signed-off-by: Torsten Rasmussen <[email protected]>
1 parent 3d24a07 commit 430370c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

cmake/modules/extensions.cmake

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1461,9 +1461,13 @@ function(import_kconfig prefix kconfig_fragment)
14611461
list(APPEND keys "${CONF_VARIABLE_NAME}")
14621462
endforeach()
14631463

1464-
foreach(outvar ${ARGN})
1465-
set(${outvar} "${keys}" PARENT_SCOPE)
1466-
endforeach()
1464+
if(ARGC GREATER 2)
1465+
if(ARGC GREATER 3)
1466+
# Two mandatory arguments and one optional, anything after that is an error.
1467+
message(FATAL_ERROR "Unexpected argument after '<keys>': import_kconfig(... ${ARGV3})")
1468+
endif()
1469+
set(${ARGV2} "${keys}" PARENT_SCOPE)
1470+
endif()
14671471
endfunction()
14681472

14691473
########################################################

0 commit comments

Comments
 (0)