Skip to content

Instantly share code, notes, and snippets.

@raspberrypisig
Forked from kassane/zcc.md
Created July 14, 2022 22:38
Show Gist options
  • Save raspberrypisig/2952f2fc410ac2599b871d70c3f50a46 to your computer and use it in GitHub Desktop.
Save raspberrypisig/2952f2fc410ac2599b871d70c3f50a46 to your computer and use it in GitHub Desktop.
Zig compiler on C/C++ projects - CMake, Meson and other

Unix-like

$> export CC="zig cc $@"
$> export CXX="zig c++ $@"
...
# your build system
$> cmake or meson - commands

Windows

PS C:\Users\My-PC\project> $Env:CC="zig cc %*"
PS C:\Users\My-PC\project> cmake or meson - commands

or Batch script:

set PATH=zig_PATH;%PATH%
set ZIG_LOCAL_CACHE="%TEMP%"" && zig cc %*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment