mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 05:44:20 +00:00
Merge 3ef44a93e6 into 53e615b920
This commit is contained in:
commit
b31ce64398
1 changed files with 11 additions and 1 deletions
12
build.zig
12
build.zig
|
|
@ -799,7 +799,17 @@ fn addCmakeCfgOptionsToExe(
|
|||
mod.linkSystemLibrary("unwind", .{});
|
||||
},
|
||||
.ios, .macos, .watchos, .tvos, .visionos => {
|
||||
mod.link_libcpp = true;
|
||||
if (static or !std.zig.system.darwin.isSdkInstalled(b.allocator)) {
|
||||
mod.link_libcpp = true;
|
||||
} else {
|
||||
// Avoid using `mod.linkSystemLibrary()`, which:
|
||||
// - is semantically equivalent to `-lc++`
|
||||
// - and enables `mod.link_libcpp`
|
||||
// Instead, add the full object pathname.
|
||||
const sdk = std.zig.system.darwin.getSdk(b.allocator, b.graph.host.result) orelse return error.SdkDetectFailed;
|
||||
const libcxx = b.pathJoin(&.{ sdk, "usr/lib/libc++.tbd" });
|
||||
exe.root_module.addObjectFile(.{ .cwd_relative = libcxx });
|
||||
}
|
||||
},
|
||||
.windows => {
|
||||
if (target.abi != .msvc) mod.link_libcpp = true;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue