# How to tell Zig not to rerun a certain step?

**URL:** <https://ziggit.dev/t/how-to-tell-zig-not-to-rerun-a-certain-step/6547>\
**Category:** Help\
**Tags:** build-system\
**Created:** [October 26, 2024, 11:55am UTC](https://ziggit.dev/t/how-to-tell-zig-not-to-rerun-a-certain-step/6547 "2024-10-26T11:55:43Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![hachanuy](https://ziggit.dev/user_avatar/ziggit.dev/hachanuy/32/3619_2.png) [@hachanuy](https://ziggit.dev/u/hachanuy)\
**Post date:** [October 26, 2024, 7:36pm UTC](https://ziggit.dev/t/how-to-tell-zig-not-to-rerun-a-certain-step/6547/8 "2024-10-26T19:36:05Z")

</div>

Following your advice, I now have the following build script

```zig
const upstream = b.dependency("upstream", .{});

const triple = target.result.linuxTriple(b.allocator) catch @panic("OOM");
const cc = b.fmt(
    "-DCMAKE_C_COMPILER='{s};cc;--target={s}'",
    .{ b.graph.zig_exe, triple },
);
const cxx = b.fmt(
    "-DCMAKE_CXX_COMPILER='{s};c++;--target={s}'",
    .{ b.graph.zig_exe, triple },
);
const build_type = if (optimize == .Debug) "-DCMAKE_BUILD_TYPE=Debug" else "-DCMAKE_BUILD_TYPE=Release";
const cmake = b.findProgram(&.{"cmake"}, &.{}) catch @panic("CMake not found");

const cmake_configure = b.addSystemCommand(&.{
    cmake,
    "-G=Ninja",
    cc,
    cxx,
    "-DWITH_TLS=OFF",
    "-DWITH_PERF_TOOL=OFF",
    "-DZMQ_BUILD_TESTS=OFF",
    "-DENABLE_CPACK=OFF",
    "-DENABLE_DRAFTS=ON",
    "-Wno-dev",
    build_type,
    "-S",
});
cmake_configure.addDirectoryArg(upstream.path(""));
cmake_configure.addArg("-B");
const build_dir = cmake_configure.addOutputDirectoryArg("build");

const cmake_build = b.addSystemCommand(&.{
    cmake,
    "--build",
});
cmake_build.addDirectoryArg(build_dir);

const library = b.addTranslateC(.{
    .root_source_file = upstream.path("include/zmq.h"),
    .target = target,
    .optimize = optimize,
});
library.step.dependOn(&cmake_build.step);

const module = b.addModule("libzmq", .{
    .root_source_file = library.getOutput(),
    .target = target,
    .optimize = optimize,
    .link_libc = true,
    .link_libcpp = true,
});
module.addObjectFile(build_dir.path(b, "lib/libzmq.a"));

```

Another project can use the `libzmq` module fine, but the `cmake_build` step is still always rerun. I guess it’s because there is no way to specify its output files.

---

_[View the full topic](https://ziggit.dev/t/how-to-tell-zig-not-to-rerun-a-certain-step/6547)._
