Function dependsOnSystemLibrary [src]

Returns whether the library, executable, or object depends on a particular system library. Includes transitive dependencies.

Prototype

pub fn dependsOnSystemLibrary(compile: *Compile, name: []const u8) bool

Parameters

compile: *Compilename: []const u8

Source

pub 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; }