| ... | @@ -560,24 +560,38 @@ fn addCmakeCfgOptionsToExe( | ... | @@ -560,24 +560,38 @@ fn addCmakeCfgOptionsToExe( |
| 560 | | 560 | |
| 561 | // System -lc++ must be used because in this code path we are attempting to link | 561 | // System -lc++ must be used because in this code path we are attempting to link |
| 562 | // against system-provided LLVM, Clang, LLD. | 562 | // against system-provided LLVM, Clang, LLD. |
| 563 | if (exe.target.getOsTag() == .linux) { | 563 | switch (exe.target.getOsTag()) { |
| 564 | // First we try to link against gcc libstdc++. If that doesn't work, we fall | 564 | .linux => { |
| 565 | // back to -lc++ and cross our fingers. | 565 | // First we try to link against gcc libstdc++. If that doesn't work, we fall |
| 566 | addCxxKnownPath(b, cfg, exe, b.fmt("libstdc++.{s}", .{lib_suffix}), "", need_cpp_includes) catch |err| switch (err) { | 566 | // back to -lc++ and cross our fingers. |
| 567 | error.RequiredLibraryNotFound => { | 567 | addCxxKnownPath(b, cfg, exe, b.fmt("libstdc++.{s}", .{lib_suffix}), "", need_cpp_includes) catch |err| switch (err) { |
| 568 | exe.linkSystemLibrary("c++"); | 568 | error.RequiredLibraryNotFound => { |
| 569 | }, | 569 | exe.linkSystemLibrary("c++"); |
| 570 | else => |e| return e, | 570 | }, |
| 571 | }; | 571 | else => |e| return e, |
| 572 | exe.linkSystemLibrary("unwind"); | 572 | }; |
| 573 | } else if (exe.target.isFreeBSD()) { | 573 | exe.linkSystemLibrary("unwind"); |
| 574 | try addCxxKnownPath(b, cfg, exe, b.fmt("libc++.{s}", .{lib_suffix}), null, need_cpp_includes); | 574 | }, |
| 575 | exe.linkSystemLibrary("pthread"); | 575 | .ios, .macos, .watchos, .tvos => { |
| 576 | } else if (exe.target.getOsTag() == .openbsd) { | 576 | exe.linkSystemLibrary("c++"); |
| 577 | try addCxxKnownPath(b, cfg, exe, b.fmt("libc++.{s}", .{lib_suffix}), null, need_cpp_includes); | 577 | }, |
| 578 | try addCxxKnownPath(b, cfg, exe, b.fmt("libc++abi.{s}", .{lib_suffix}), null, need_cpp_includes); | 578 | .freebsd => { |
| 579 | } else if (exe.target.isDarwin()) { | 579 | try addCxxKnownPath(b, cfg, exe, b.fmt("libc++.{s}", .{lib_suffix}), null, need_cpp_includes); |
| 580 | exe.linkSystemLibrary("c++"); | 580 | try addCxxKnownPath(b, cfg, exe, b.fmt("libgcc_eh.{s}", .{lib_suffix}), null, need_cpp_includes); |
| | 581 | }, |
| | 582 | .openbsd => { |
| | 583 | try addCxxKnownPath(b, cfg, exe, b.fmt("libc++.{s}", .{lib_suffix}), null, need_cpp_includes); |
| | 584 | try addCxxKnownPath(b, cfg, exe, b.fmt("libc++abi.{s}", .{lib_suffix}), null, need_cpp_includes); |
| | 585 | }, |
| | 586 | .netbsd => { |
| | 587 | try addCxxKnownPath(b, cfg, exe, b.fmt("libstdc++.{s}", .{lib_suffix}), null, need_cpp_includes); |
| | 588 | try addCxxKnownPath(b, cfg, exe, b.fmt("libgcc_eh.{s}", .{lib_suffix}), null, need_cpp_includes); |
| | 589 | }, |
| | 590 | .dragonfly => { |
| | 591 | try addCxxKnownPath(b, cfg, exe, b.fmt("libstdc++.{s}", .{lib_suffix}), null, need_cpp_includes); |
| | 592 | try addCxxKnownPath(b, cfg, exe, b.fmt("libgcc_eh.{s}", .{lib_suffix}), null, need_cpp_includes); |
| | 593 | }, |
| | 594 | else => {}, |
| 581 | } | 595 | } |
| 582 | } | 596 | } |
| 583 | | 597 | |