zig-sqlite icon indicating copy to clipboard operation
zig-sqlite copied to clipboard

build.zig: Configure module to be used downstream

Open JacobCrabill opened this issue 1 year ago • 0 comments

Description

With the recent Zig build system changes, Modules now work much like CMake library targets, in that settings applied to one module are applied to any other module which imports that module as a dependency. For example, with my current changes, I'm able to do the following (at least for my use case):

// Example setup in build.zig
const sqlite = b.dependency("sqlite", .{
    .target = target,
    .optimize = optimize,
    .use_bundled = true,
});
exe.root_module.addImport("sqlite", sqlite.module("sqlite"));
// Note that we no longer need to access and link to the "sqlite" artifact,
// nor add any include directories

JacobCrabill avatar Jan 30 '24 06:01 JacobCrabill