Skip to content

Commit

Permalink
Turn off CMake compile launcher when using zig
Browse files Browse the repository at this point in the history
This setting is for things like `ccache`, but if Meson treats zig that
way, then it will expand the second argument to become:
```
/usr/bin/zig /usr/lib64/ccache/cc
```
in CMake and `/usr/lib64/ccache/cc` is _not_ an argument to `zig`.

If you run
```
$ CC='zig cc' CXX='zig c++' ./meson.py setup 'test cases/cmake/1 basic' build
```
then CMake will fail to compile a "simple test program" and setup
fails.
  • Loading branch information
QuLogic committed Oct 4, 2024
1 parent 3c2d04d commit 9a5249a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mesonbuild/cmake/toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ def is_cmdline_option(compiler: 'Compiler', arg: str) -> bool:
if compiler.get_argument_syntax() == 'msvc':
return arg.startswith('/')
else:
if compiler.exelist[0] == 'zig' and arg in {'ar', 'cc', 'c++', 'dlltool', 'lib', 'ranlib', 'objcopy', 'rc'}:
return True
return arg.startswith('-')

def update_cmake_compiler_state(self) -> None:
Expand Down

0 comments on commit 9a5249a

Please sign in to comment.