app: cmake: use $ENV{ZEPHYR_BASE} as hint

That's the common way to do this and has the advantage that it works
when the zephyr repo is an a different location and was not registered
in the users cmake registry - which is a very common usecase supported
by zephyr. You end up with that by `west init`-ing the git url of either
the zmk repo directly or another manifest repo which imports the zmk
repo. This is more convenient than the whole manual `west init -l`
stuff.

This works because west automatically exports the `ZEPHYR_BASE`
environment variable to all extensions - including `west build`.
For that exact reason it should not break anyones scripts unless they're
using cmake directly and didn't set the $ZEPHYR_BASE environment
variable.
This commit is contained in:
Michael Zimmermann 2023-09-22 08:34:26 +02:00
parent 28ce23d489
commit 878e96dd9a

View file

@ -12,7 +12,7 @@ list(APPEND ZEPHYR_EXTRA_MODULES
) )
# Find Zephyr. This also loads Zephyr's build system. # Find Zephyr. This also loads Zephyr's build system.
find_package(Zephyr REQUIRED HINTS ../zephyr) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(zmk) project(zmk)
zephyr_linker_sources(RODATA include/linker/zmk-events.ld) zephyr_linker_sources(RODATA include/linker/zmk-events.ld)