Skip to content

Conversation

@thorsten-klein
Copy link
Contributor

@thorsten-klein thorsten-klein commented Dec 23, 2025

Why?

When using west aliases, it is helpful for users to give cmake arguments, e.g. to make building specific variants as easy as possible. Currently -- must be used, e.g.

[alias]
build-llvm = build -- -DZEPHYR_TOOLCHAIN_VARIANT=llvm
build-codechecker = build -- -DZEPHYR_SCA_VARIANT=codechecker
build-llvm-codechecker = build -- -DZEPHYR_TOOLCHAIN_VARIANT=llvm -DZEPHYR_SCA_VARIANT=codechecker

With this approach it is not possible anymore to specify west arguments when the alias is used (e.g. board -b native_sim), as the argument comes behind -- and therefore it is handled as cmake argument.

Solution

Support for --cmake-opt argument is added which allows specifiying cmake options via west build --cmake-opt=<arg>, in order to avoid -- in alias commands. This argument can be specified multiple times, e.g.

[alias]
build-llvm = build --cmake-opt=-DZEPHYR_TOOLCHAIN_VARIANT=llvm
build-codechecker = build --cmake-opt=-DZEPHYR_SCA_VARIANT=codechecker
build-llvm-codechecker = build --cmake-opt=-DZEPHYR_TOOLCHAIN_VARIANT=llvm --cmake-opt=-DZEPHYR_SCA_VARIANT=codechecker

# or even easier: build-llvm can be reused
build-llvm-codechecker = build-llvm --cmake-opt=-DZEPHYR_SCA_VARIANT=codechecker

@zephyrbot zephyrbot added the area: West West utility label Dec 23, 2025
@thorsten-klein thorsten-klein force-pushed the cmake-opts branch 2 times, most recently from 05dfcb7 to 5fb585f Compare December 23, 2025 08:53
@thorsten-klein thorsten-klein changed the title scripts: west_commands: build: support --cmake-opts scripts: west_commands: build: support --cmake-opt Dec 23, 2025
@thorsten-klein thorsten-klein force-pushed the cmake-opts branch 3 times, most recently from fc00875 to c510ec9 Compare December 23, 2025 09:18
Support cmake options specified via argument --cmake-opt, in order to
avoid `--` in alias commands.

Signed-off-by: Thorsten Klein <[email protected]>
@sonarqubecloud
Copy link

@pdgendt pdgendt requested review from nordicjm and tejlmand December 23, 2025 11:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: West West utility

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants