| ... | ... | @@ -630,14 +630,16 @@ fn addCmakeCfgOptionsToExe( |
| 630 | 630 | const lib_suffix = if (static) exe.target.staticLibSuffix()[1..] else exe.target.dynamicLibSuffix()[1..]; |
| 631 | 631 | switch (exe.target.getOsTag()) { |
| 632 | 632 | .linux => { |
| 633 | | // First we try to link against gcc libstdc++. If that doesn't work, we fall |
| 634 | | // back to -lc++ and cross our fingers. |
| 635 | | addCxxKnownPath(b, cfg, exe, b.fmt("libstdc++.{s}", .{lib_suffix}), "", need_cpp_includes) catch |err| switch (err) { |
| 636 | | error.RequiredLibraryNotFound => { |
| 637 | | exe.linkLibCpp(); |
| 638 | | }, |
| 639 | | else => |e| return e, |
| 640 | | }; |
| 633 | // First we try to link against system libstdc++ or libc++. |
| 634 | // If that doesn't work, we fall to -lc++ and cross our fingers. |
| 635 | const found = for ([_][]const u8{ "stdc++", "c++" }) |name| { |
| 636 | addCxxKnownPath(b, cfg, exe, b.fmt("lib{s}.{s}", .{ name, lib_suffix }), "", need_cpp_includes) catch |err| switch (err) { |
| 637 | error.RequiredLibraryNotFound => continue, |
| 638 | else => |e| return e, |
| 639 | }; |
| 640 | break true; |
| 641 | } else false; |
| 642 | if (!found) exe.linkLibCpp(); |
| 641 | 643 | exe.linkSystemLibrary("unwind"); |
| 642 | 644 | }, |
| 643 | 645 | .ios, .macos, .watchos, .tvos => { |