cmake: default value for KCONFIG_BINARY_DIR moved to zephyr_modules

This is a cleanup commit moves the default setting of KCONFIG_BINARY_DIR
from boilerplate.cmake to zephyr_modules.cmake to prepare for better
re-usability.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
This commit is contained in:
Torsten Rasmussen 2021-12-15 15:22:39 +01:00 committed by Marti Bolivar
commit 0a9a3c0a79
2 changed files with 12 additions and 10 deletions

View file

@ -144,14 +144,6 @@ include(${ZEPHYR_BASE}/cmake/python.cmake)
include(${ZEPHYR_BASE}/cmake/west.cmake) include(${ZEPHYR_BASE}/cmake/west.cmake)
include(${ZEPHYR_BASE}/cmake/ccache.cmake) include(${ZEPHYR_BASE}/cmake/ccache.cmake)
if(ZEPHYR_EXTRA_MODULES)
# ZEPHYR_EXTRA_MODULES has either been specified on the cmake CLI or is
# already in the CMakeCache.txt. This has precedence over the environment
# variable ZEPHYR_EXTRA_MODULES
elseif(DEFINED ENV{ZEPHYR_EXTRA_MODULES})
set(ZEPHYR_EXTRA_MODULES $ENV{ZEPHYR_EXTRA_MODULES})
endif()
# 'MODULE_EXT_ROOT' is a prioritized list of directories where module glue code # 'MODULE_EXT_ROOT' is a prioritized list of directories where module glue code
# may be found. It always includes ${ZEPHYR_BASE} at the lowest priority. # may be found. It always includes ${ZEPHYR_BASE} at the lowest priority.
# For module roots, later entries may overrule module settings already defined # For module roots, later entries may overrule module settings already defined
@ -164,8 +156,6 @@ list(INSERT MODULE_EXT_ROOT 0 ${ZEPHYR_BASE})
# Those may contain additional DTS, BOARD, SOC, ARCH ROOTs. # Those may contain additional DTS, BOARD, SOC, ARCH ROOTs.
# Also create the Kconfig binary dir for generated Kconf files. # Also create the Kconfig binary dir for generated Kconf files.
# #
set(KCONFIG_BINARY_DIR ${CMAKE_BINARY_DIR}/Kconfig)
file(MAKE_DIRECTORY ${KCONFIG_BINARY_DIR})
include(${ZEPHYR_BASE}/cmake/zephyr_module.cmake) include(${ZEPHYR_BASE}/cmake/zephyr_module.cmake)
if(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR}) if(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})

View file

@ -23,6 +23,17 @@
# - `ZEPHYR_<MODULE_NAME>_KCONFIG` is used for inclusion of the Kconfig # - `ZEPHYR_<MODULE_NAME>_KCONFIG` is used for inclusion of the Kconfig
# files into the build system. # files into the build system.
# Settings used by Zephyr module but where systems may define an alternative value.
set_ifndef(KCONFIG_BINARY_DIR ${CMAKE_BINARY_DIR}/Kconfig)
if(ZEPHYR_EXTRA_MODULES)
# ZEPHYR_EXTRA_MODULES has either been specified on the cmake CLI or is
# already in the CMakeCache.txt. This has precedence over the environment
# variable ZEPHYR_EXTRA_MODULES
elseif(DEFINED ENV{ZEPHYR_EXTRA_MODULES})
set(ZEPHYR_EXTRA_MODULES $ENV{ZEPHYR_EXTRA_MODULES})
endif()
if(ZEPHYR_MODULES) if(ZEPHYR_MODULES)
set(ZEPHYR_MODULES_ARG "--modules" ${ZEPHYR_MODULES}) set(ZEPHYR_MODULES_ARG "--modules" ${ZEPHYR_MODULES})
endif() endif()
@ -31,6 +42,7 @@ if(ZEPHYR_EXTRA_MODULES)
set(ZEPHYR_EXTRA_MODULES_ARG "--extra-modules" ${ZEPHYR_EXTRA_MODULES}) set(ZEPHYR_EXTRA_MODULES_ARG "--extra-modules" ${ZEPHYR_EXTRA_MODULES})
endif() endif()
file(MAKE_DIRECTORY ${KCONFIG_BINARY_DIR})
set(KCONFIG_MODULES_FILE ${KCONFIG_BINARY_DIR}/Kconfig.modules) set(KCONFIG_MODULES_FILE ${KCONFIG_BINARY_DIR}/Kconfig.modules)
set(ZEPHYR_SETTINGS_FILE ${CMAKE_BINARY_DIR}/zephyr_settings.txt) set(ZEPHYR_SETTINGS_FILE ${CMAKE_BINARY_DIR}/zephyr_settings.txt)