mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +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)
|
if (!std.process.can_spawn)
|
||||||
return error.RequiredLibraryNotFound;
|
return error.RequiredLibraryNotFound;
|
||||||
|
|
||||||
const path_padded = if (ctx.cxx_compiler_arg1.len > 0)
|
const path_padded = run: {
|
||||||
b.run(&.{ ctx.cxx_compiler, ctx.cxx_compiler_arg1, b.fmt("-print-file-name={s}", .{objname}) })
|
var args = std.ArrayList([]const u8).init(b.allocator);
|
||||||
else
|
try args.append(ctx.cxx_compiler);
|
||||||
b.run(&.{ ctx.cxx_compiler, b.fmt("-print-file-name={s}", .{objname}) });
|
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");
|
var tokenizer = mem.tokenizeAny(u8, path_padded, "\r\n");
|
||||||
const path_unpadded = tokenizer.next().?;
|
const path_unpadded = tokenizer.next().?;
|
||||||
if (mem.eql(u8, path_unpadded, objname)) {
|
if (mem.eql(u8, path_unpadded, objname)) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user