mirror of
https://github.com/allyourcodebase/googletest.git
synced 2026-11-17 01:20:35 +00:00
googletest packaged with Zig
- Zig 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .github/workflows | ||
| .gitignore | ||
| build.zig | ||
| build.zig.zon | ||
| LICENSE | ||
| README.md | ||
googletest
This is googletest, packaged for Zig.
How to use it
First, update your build.zig.zon:
zig fetch --save git+https://github.com/allyourcodebase/googletest
Next, in build.zig, declare the dependency and link your test with the static libraries:
const googletest_dep = b.dependency("googletest", .{
.target = target,
.optimize = optimize,
});
const tests_exe = b.addExecutable(.{
.name = "tests",
.root_module = b.createModule(.{ .target = target, .optimize = optimize }),
});
tests_exe.addCSourceFiles(.{ .files = &.{"src/tests.cpp"} }); // your test files
tests_exe.linkLibrary(googletest_dep.artifact("gtest"));
// Unless you define your own entry point, you need `gtest_main` too.
tests_exe.linkLibrary(googletest_dep.artifact("gtest_main"));