Skip to content
Permalink
Browse files

cmake: Allow import_kconfig() to return a list of the variables it sets

This allows the variables to easily be iterated over.

Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
  • Loading branch information...
oyvindronningstad authored and carlescufi committed May 3, 2019
1 parent e9a4ef2 commit 28bb9750a0541d8e8bca99ca9d064cdbf1e83fa9
Showing with 9 additions and 1 deletion.
  1. +9 −1 cmake/extensions.cmake
@@ -916,9 +916,12 @@ endfunction()

# 2.2 Misc
#
# import_kconfig(<prefix> <kconfig_fragment> [<keys>])
#
# Parse a KConfig fragment (typically with extension .config) and
# introduce all the symbols that are prefixed with 'prefix' into the
# CMake namespace
# CMake namespace. List all created variable names in the 'keys'
# output variable if present.
function(import_kconfig prefix kconfig_fragment)
# Parse the lines prefixed with 'prefix' in ${kconfig_fragment}
file(
@@ -946,6 +949,11 @@ function(import_kconfig prefix kconfig_fragment)
endif()

set("${CONF_VARIABLE_NAME}" "${CONF_VARIABLE_VALUE}" PARENT_SCOPE)
list(APPEND keys "${CONF_VARIABLE_NAME}")
endforeach()

foreach(outvar ${ARGN})
set(${outvar} "${keys}" PARENT_SCOPE)
endforeach()
endfunction()

0 comments on commit 28bb975

Please sign in to comment.
You can’t perform that action at this time.