cmake: import_kconfig: Generalize 'import_kconfig' to support DT
Generalize 'import_kconfig' to support parsing symbols with other prefixes than 'CONFIG_'. This will eventually allow us to also import 'DT_' symbols into the CMake namespace. Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
This commit is contained in:
parent
667d6c97b0
commit
c842fb88d7
3 changed files with 6 additions and 6 deletions
|
@ -193,7 +193,7 @@ if(CONFIG_HAS_DTS)
|
|||
message(FATAL_ERROR "command failed with return code: ${ret}")
|
||||
endif()
|
||||
|
||||
import_kconfig(${GENERATED_DTS_BOARD_CONF})
|
||||
import_kconfig(CONFIG_ ${GENERATED_DTS_BOARD_CONF})
|
||||
|
||||
else()
|
||||
file(WRITE ${GENERATED_DTS_BOARD_H} "/* WARNING. THIS FILE IS AUTO-GENERATED. DO NOT MODIFY! */")
|
||||
|
|
|
@ -745,15 +745,15 @@ endfunction()
|
|||
# 2.2 Misc
|
||||
#
|
||||
# Parse a KConfig fragment (typically with extension .config) and
|
||||
# introduce all the symbols that are prefixed with 'CONFIG_' into the
|
||||
# introduce all the symbols that are prefixed with 'prefix' into the
|
||||
# CMake namespace
|
||||
function(import_kconfig kconfig_fragment)
|
||||
# Parse the lines prefixed with 'CONFIG_' in ${kconfig_fragment}
|
||||
function(import_kconfig prefix kconfig_fragment)
|
||||
# Parse the lines prefixed with 'prefix' in ${kconfig_fragment}
|
||||
file(
|
||||
STRINGS
|
||||
${kconfig_fragment}
|
||||
DOT_CONFIG_LIST
|
||||
REGEX "^CONFIG_"
|
||||
REGEX "^${prefix}"
|
||||
ENCODING "UTF-8"
|
||||
)
|
||||
|
||||
|
|
|
@ -177,7 +177,7 @@ foreach (name ${cache_variable_names})
|
|||
endforeach()
|
||||
|
||||
# Parse the lines prefixed with CONFIG_ in the .config file from Kconfig
|
||||
import_kconfig(${DOTCONFIG})
|
||||
import_kconfig(CONFIG_ ${DOTCONFIG})
|
||||
|
||||
# Re-introduce the CLI Kconfig symbols that survived
|
||||
foreach (name ${cache_variable_names})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue