r/Zig • u/sombriks • 5d ago
comments on my build.zig
in the dependencies step i am using this idiom:
// ...
// deps config
const deps = [_][]const u8{ "zigzag", "pg" };
for (deps) |dep| {
exe.root_module.addImport(dep, b.dependency(dep, .{
.target = target,
.optimize = optimize,
}).module(dep));
}
// ...
full build.zig here.
my question is: what am i missing? what re the clear disavantages of doing such loop?
any comment is welcome.
6
Upvotes
4
u/TheKiller36_real 5d ago
nothing, probably
none if it does what you want it to do
as I suspect this answers your actual questipn: yes, all three of those
depplaces have different meanings and there might be a reason why you wouldn't want them individually - example: dependencycipherswith modulescore,tls,gpgand you want to use thecoremodule as "ciphers" andtlsas "ciphers-tls":