summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorManlio Perillo <manlio.perillo@gmail.com>2023-04-08 09:51:07 +0200
committerManlio Perillo <manlio.perillo@gmail.com>2023-04-11 12:45:27 +0200
commit67f369484cbba0be0c6dcb9b73cf7f872a25baf7 (patch)
treedc60a32e83685f9aab3162645f44b0d935c72ab2
parent1cf910fb51259e786e8964072eb98a17353bc3c8 (diff)
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
-rw-r--r--build.zig3
1 files changed, 3 insertions, 0 deletions
diff --git a/build.zig b/build.zig
index 6a0bcb8..ca76dab 100644
--- a/build.zig
+++ b/build.zig
@@ -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();