1# SPDX-License-Identifier: Apache-2.0
2
3set(CONFIGS_C ${CMAKE_CURRENT_BINARY_DIR}/misc/generated/configs.c)
4
5file(STRINGS
6  ${AUTOCONF_H}
7  LIST_OF_CONFIGS
8  REGEX "^#define CONFIG_"
9  ENCODING "UTF-8"
10  )
11foreach (CONFIG ${LIST_OF_CONFIGS})
12  string(REGEX REPLACE "#define (CONFIG_[A-Z|_|0-9]*) (.*)" "GEN_ABSOLUTE_SYM_KCONFIG(\\1, \\2)" CONFIG ${CONFIG})
13  string(REGEX REPLACE "\"(.*)\"" "1" CONFIG ${CONFIG})
14  set(GEN_ABS_SYM_LIST "${GEN_ABS_SYM_LIST}${CONFIG};\n")
15endforeach()
16
17configure_file(${CMAKE_CURRENT_LIST_DIR}/configs.c.in ${CONFIGS_C})
18zephyr_sources(                                       ${CONFIGS_C})
19