From eda59e141d30204908ef1f56b2637164310c9ccc Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 10 Mar 2024 23:26:02 -0400 Subject: [PATCH] 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. --- mesonbuild/cmake/toolchain.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mesonbuild/cmake/toolchain.py b/mesonbuild/cmake/toolchain.py index 89d5d84449e0..7d73a7cea014 100644 --- a/mesonbuild/cmake/toolchain.py +++ b/mesonbuild/cmake/toolchain.py @@ -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: