Skip to content

Commit 7998bae

Browse files
joerchannordicjm
authored andcommitted
[nrf fromtree] cmake: kconfig: Add APP_DIR to kconfig environment
Add APP_DIR as a kconfig environment variable. This is useful in cases where you want to set a config path relative to the directory of the application. An example of this is how many sysbuild.cmake files sets the source directory like this: ExternalZephyrProject_Add( APPLICATION remote SOURCE_DIR ${APP_DIR}/remote BOARD ${SB_CONFIG_REMOTE_BOARD} ) The same however cannot be done in Kconfig.sysbuild: config NETCORE_IMAGE_PATH default "${APP_DIR}/<image_path>" if NETCORE_ABC Instead they must use ZEPHYR_MY_MODULE_MODULE_DIR, however not all applications are part of a zephyr module. Signed-off-by: Joakim Andersson <joerchan@gmail.com> (cherry picked from commit 12fdde6694e7a1be065d65c335aeadf7129e34bf)
1 parent 7830f6c commit 7998bae

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

cmake/modules/kconfig.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,17 @@ else()
135135
set(_local_TOOLCHAIN_HAS_PICOLIBC n)
136136
endif()
137137

138+
# APP_DIR: Path to the main image (sysbuild) or synonym for APPLICATION_SOURCE_DIR (non-sysbuild)
139+
zephyr_get(APP_DIR VAR APP_DIR APPLICATION_SOURCE_DIR)
140+
138141
set(COMMON_KCONFIG_ENV_SETTINGS
139142
PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
140143
srctree=${ZEPHYR_BASE}
141144
KERNELVERSION=${KERNELVERSION}
142145
APPVERSION=${APP_VERSION_STRING}
143146
APP_VERSION_EXTENDED_STRING=${APP_VERSION_EXTENDED_STRING}
144147
APP_VERSION_TWEAK_STRING=${APP_VERSION_TWEAK_STRING}
148+
APP_DIR=${APP_DIR}
145149
CONFIG_=${KCONFIG_NAMESPACE}_
146150
KCONFIG_CONFIG=${DOTCONFIG}
147151
KCONFIG_BOARD_DIR=${KCONFIG_BOARD_DIR}

0 commit comments

Comments
 (0)