#Getting version from build.zig.zon?
1 messages · Page 1 of 1 (latest)
in your build.zig:
var options = b.addOptions();
options.addOption([]const u8, "version", @import("build.zig.zon").version);
exe.root_module.addOptions("options", options);
then in your code you can do:
const version = @import("options").version;
i suppose you could even import the build.zig.zon file in your code directly bypassing build.zig entirely, but i think this is probably the standard way to do this