build: ensure the exercise links libc, when needed

When running, as an example, `zig build -Dhealed -Dn=93 test`, the build
fails, because the `test` step use the standard CompileStep, instead of
ZiglingStep.

Ensure that exercises using libc are correctly built.

Closes #229
This commit is contained in:
Manlio Perillo 2023-04-08 09:51:07 +02:00
parent 1cf910fb51
commit 67f369484c

View file

@ -560,6 +560,9 @@ pub fn build(b: *Build) !void {
}) catch unreachable;
const build_step = b.addExecutable(.{ .name = base_name, .root_source_file = .{ .path = file_path } });
if (ex.C) {
build_step.linkLibC();
}
build_step.install();
const run_step = build_step.run();