pub fn dependsOnSystemLibrary(compile: *Compile, name: []const u8) bool compile: *Compilename: []const u8591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619pub fn dependsOnSystemLibrary(compile: *Compile, name: []const u8) bool {
var is_linking_libc = false;
var is_linking_libcpp = false;
for (compile.getCompileDependencies(true)) |some_compile| {
for (some_compile.root_module.getGraph().modules) |mod| {
for (mod.link_objects.items) |lo| {
switch (lo) {
.system_lib => |lib| if (mem.eql(u8, lib.name, name)) return true,
else => {},
}
}
if (mod.link_libc orelse false) is_linking_libc = true;
if (mod.link_libcpp orelse false) is_linking_libcpp = true;
}
}
const target = compile.rootModuleTarget();
if (std.zig.target.isLibCLibName(&target, name)) {
return is_linking_libc;
}
if (std.zig.target.isLibCxxLibName(&target, name)) {
return is_linking_libcpp;
}
return false;
}
Returns whether the library, executable, or object depends on a particular system library. Includes transitive dependencies.