mirror of
https://github.com/ziglang/zig.git
synced 2024-11-30 00:52:52 +00:00
build.zig: support multiple args in cxx_compiler_arg1
An example of this happening is during CI runs where it has a value such as `c++ -target x86_64-linux-musl -mcpu=baseline`.
This commit is contained in:
parent
6f08e17229
commit
51e96a823c
12
build.zig
12
build.zig
@ -811,10 +811,14 @@ fn addCxxKnownPath(
|
||||
if (!std.process.can_spawn)
|
||||
return error.RequiredLibraryNotFound;
|
||||
|
||||
const path_padded = if (ctx.cxx_compiler_arg1.len > 0)
|
||||
b.run(&.{ ctx.cxx_compiler, ctx.cxx_compiler_arg1, b.fmt("-print-file-name={s}", .{objname}) })
|
||||
else
|
||||
b.run(&.{ ctx.cxx_compiler, b.fmt("-print-file-name={s}", .{objname}) });
|
||||
const path_padded = run: {
|
||||
var args = std.ArrayList([]const u8).init(b.allocator);
|
||||
try args.append(ctx.cxx_compiler);
|
||||
var it = std.mem.tokenizeAny(u8, ctx.cxx_compiler_arg1, &std.ascii.whitespace);
|
||||
while (it.next()) |arg| try args.append(arg);
|
||||
try args.append(b.fmt("-print-file-name={s}", .{objname}));
|
||||
break :run b.run(args.items);
|
||||
};
|
||||
var tokenizer = mem.tokenizeAny(u8, path_padded, "\r\n");
|
||||
const path_unpadded = tokenizer.next().?;
|
||||
if (mem.eql(u8, path_unpadded, objname)) {
|
||||
|
Loading…
Reference in New Issue
Block a user