From e7fdc84696c78193923de411f7a75f8cf78d142f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Pouiller?= Date: Wed, 25 Jun 2025 21:11:10 +0200 Subject: [PATCH] cmake: Fix support for "ninja flash" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit By default west looks at the parents directory to find Zephyr base directory. However, in the case the build directory is not a subdirectory of zephyr base and the user run "ninja flash" directly from the build directory, west fails to detect Zephyr base. So, this patch explicitly add ZEPHYR_BASE in the environment. Implementation notes: * ZEPHYR_BASE is already set for ninja menuconfig in cmake/modules/kconfig.cmake:201 * ZEPHYR_BASE seems better than --zephyr-base since the environment in inherited * BTW, --zephyr-base seems to not have any impact and seems broken Signed-off-by: Jérôme Pouiller --- cmake/flash/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/flash/CMakeLists.txt b/cmake/flash/CMakeLists.txt index 8b2f17aff95..985b7536154 100644 --- a/cmake/flash/CMakeLists.txt +++ b/cmake/flash/CMakeLists.txt @@ -196,7 +196,7 @@ foreach(target flash debug debugserver attach rtt) -DDEPENDENCIES="$" -P ${CMAKE_CURRENT_LIST_DIR}/check_runner_dependencies.cmake COMMAND - ${CMAKE_COMMAND} -E env + ${CMAKE_COMMAND} -E env ZEPHYR_BASE=${ZEPHYR_BASE} ${WEST} ${RUNNER_VERBOSE} ${target}