Skip to content

Commit 26cea27

Browse files
committed
Turn off CMake compile launcher when using zig
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.
1 parent d48602a commit 26cea27

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

mesonbuild/cmake/toolchain.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,8 @@ def is_cmdline_option(compiler: 'Compiler', arg: str) -> bool:
198198
if compiler.get_argument_syntax() == 'msvc':
199199
return arg.startswith('/')
200200
else:
201+
if compiler.exelist[0] == 'zig' and arg in {'ar', 'cc', 'c++', 'dlltool', 'lib', 'ranlib', 'objcopy', 'rc'}:
202+
return True
201203
return arg.startswith('-')
202204

203205
def update_cmake_compiler_state(self) -> None:

0 commit comments

Comments
 (0)