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 <sigvart.hovland@nordicsemi.no>
This commit is contained in:
Sigvart Hovland 2019-04-12 12:17:14 +02:00 committed by Anas Nashif
parent d2291c4b12
commit 3ffdcf4fca
2 changed files with 5 additions and 0 deletions

View file

@ -77,8 +77,12 @@ set(PROJECT_SOURCE_DIR $ENV{ZEPHYR_BASE})
# Convert path to use the '/' separator
string(REPLACE "\\" "/" PROJECT_SOURCE_DIR ${PROJECT_SOURCE_DIR})
# Remove trailing '/', it results in ugly paths and also exposes some bugs
string(REGEX REPLACE "\/+$" "" PROJECT_SOURCE_DIR ${PROJECT_SOURCE_DIR})
set(ZEPHYR_BINARY_DIR ${PROJECT_BINARY_DIR})
set(ZEPHYR_BASE ${PROJECT_SOURCE_DIR})
set(ENV{ZEPHYR_BASE} ${ZEPHYR_BASE})
set(AUTOCONF_H ${__build_dir}/include/generated/autoconf.h)
# Re-configure (Re-execute all CMakeLists.txt code) when autoconf.h changes

View file

@ -63,6 +63,7 @@ foreach(kconfig_target
PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
srctree=${ZEPHYR_BASE}
KERNELVERSION=${KERNELVERSION}
ZEPHYR_BASE=${ZEPHYR_BASE}
KCONFIG_CONFIG=${DOTCONFIG}
ARCH=$ENV{ARCH}
BOARD_DIR=$ENV{BOARD_DIR}