mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-07 14:24:43 +00:00
Merge 3ef44a93e6 into 53e615b920
This commit is contained in:
commit
b31ce64398
1 changed files with 11 additions and 1 deletions
10
build.zig
10
build.zig
|
|
@ -799,7 +799,17 @@ fn addCmakeCfgOptionsToExe(
|
||||||
mod.linkSystemLibrary("unwind", .{});
|
mod.linkSystemLibrary("unwind", .{});
|
||||||
},
|
},
|
||||||
.ios, .macos, .watchos, .tvos, .visionos => {
|
.ios, .macos, .watchos, .tvos, .visionos => {
|
||||||
|
if (static or !std.zig.system.darwin.isSdkInstalled(b.allocator)) {
|
||||||
mod.link_libcpp = true;
|
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 => {
|
.windows => {
|
||||||
if (target.abi != .msvc) mod.link_libcpp = true;
|
if (target.abi != .msvc) mod.link_libcpp = true;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue