Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

M1cha
Copy link

@M1cha M1cha commented Sep 22, 2023

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.

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.
@M1cha M1cha requested a review from a team as a code owner September 22, 2023 06:45
@caksoylar caksoylar added the core Core functionality/behavior of ZMK label Sep 25, 2023
@petejohanson
Copy link
Contributor

I'm a tad wary to do this, as it forces setting that, which IIRC, we had issues with previously, which is why we moved to the relative directory version as found here.

@M1cha
Copy link
Author

M1cha commented Oct 2, 2023

I can't find any documentation of these issues since it's basically been in git forever. The HINT is just a hint though. Meaning it doesn't have to exist and it will look in the global cmake package registry as a fallback. Setting ZEPHYR_ENV is only necessary when not using west because west sets it automatically. Not using west is also something that I would not recommend and that doesn't seem to be used by this projects CI (which is why it passed).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core functionality/behavior of ZMK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants