Skip to content

Commit 3ffdcf4

Browse files
sigvartmhnashif
authored andcommitted
cmake: boilerplate: Fix ZEPHYR_BASE variable for windows
In windows an additional / is added when using zephyr-env.cmd this causes a build error in some scenarios. It also creates ugly file paths. Signed-off-by: Sigvart Hovland <[email protected]>
1 parent d2291c4 commit 3ffdcf4

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

cmake/app/boilerplate.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,12 @@ set(PROJECT_SOURCE_DIR $ENV{ZEPHYR_BASE})
7777
# Convert path to use the '/' separator
7878
string(REPLACE "\\" "/" PROJECT_SOURCE_DIR ${PROJECT_SOURCE_DIR})
7979

80+
# Remove trailing '/', it results in ugly paths and also exposes some bugs
81+
string(REGEX REPLACE "\/+$" "" PROJECT_SOURCE_DIR ${PROJECT_SOURCE_DIR})
82+
8083
set(ZEPHYR_BINARY_DIR ${PROJECT_BINARY_DIR})
8184
set(ZEPHYR_BASE ${PROJECT_SOURCE_DIR})
85+
set(ENV{ZEPHYR_BASE} ${ZEPHYR_BASE})
8286

8387
set(AUTOCONF_H ${__build_dir}/include/generated/autoconf.h)
8488
# Re-configure (Re-execute all CMakeLists.txt code) when autoconf.h changes

cmake/kconfig.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ foreach(kconfig_target
6363
PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
6464
srctree=${ZEPHYR_BASE}
6565
KERNELVERSION=${KERNELVERSION}
66+
ZEPHYR_BASE=${ZEPHYR_BASE}
6667
KCONFIG_CONFIG=${DOTCONFIG}
6768
ARCH=$ENV{ARCH}
6869
BOARD_DIR=$ENV{BOARD_DIR}

0 commit comments

Comments
 (0)