#how do I add a compile option to my build system?
1 messages · Page 1 of 1 (latest)
something like this. i haven't tested this code, but adapted it from another project which works.
pub fn build(b: *Builder) !void {
const exe = ...
const options = b.addOptions();
const option = b.option(bool, "name", "description") orelse false;
options.addOption(bool, "name", option);
exe.addModule("build_options", options.createModule());
}
after this, you can pass this option like
zig build -Dname
i think for booleans adding =true is optional
and in your code,
const build_options = @import"build_options");
const name = build_options.name:
thanks!