libssh2 packaged with Zig
- Install as dependency using
zig fetch --save git+https://github.com/{repo_name} - Link this library in build.zig
const exe = b.addExecutable(.{
.name = "test_name",
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
});
// import libssh2
const libssh2 = b.dependency("libssh2", .{
.target = target,
.optimize = optimize,
});
exe.linkLibrary(libssh2.artifact("ssh2"));
b.installArtifact(exe);
- Import using
@cImport()