# Zig Authors - Zig Build System (Highlights) ![rw-book-cover|256](https://readwise-assets.s3.amazonaws.com/static/images/article0.00998d930354.png) ## Metadata **Review**:: [readwise.io](https://readwise.io/bookreview/56243892) **Source**:: #from/readwise #from/reader **Zettel**:: #zettel/fleeting **Status**:: #x **Authors**:: [[Zig Authors]] **Full Title**:: Zig Build System **Category**:: #articles #readwise/articles **Category Icon**:: 📰 **URL**:: [ziglang.org](https://ziglang.org/learn/build-system/) **Host**:: [[ziglang.org]] **Highlighted**:: [[2025-11-14]] **Created**:: [[2025-11-15]] ## Highlights - By default, the main step in the graph is the **Install** step, whose purpose is to copy build artifacts into their final resting place. The Install step starts with no dependencies, and therefore nothing will happen when `zig build` is run. A project’s build script must add to the set of things to install, which is what the `installArtifact` function call does above. ([View Highlight](https://read.readwise.io/read/01ka0z50j1qrrtby3vy4606jgy)) ^957316056 - Most projects want to provide the ability to change the target and optimization settings. In order to encourage standard naming conventions for these options, Zig provides the helper functions, `standardTargetOptions` and `standardOptimizeOption`. ([View Highlight](https://read.readwise.io/read/01ka0z84epf28tap0hdgrbz3f8)) ^957316811 - Standard optimization options allow the person running `zig build` to select between `Debug`, `ReleaseSafe`, `ReleaseFast`, and `ReleaseSmall`. ([View Highlight](https://read.readwise.io/read/01ka0za2pa2273xavbp1jxxpmj)) ^957316852 - To pass options from the build script and into the project’s Zig code, use the `Options` step. ([View Highlight](https://read.readwise.io/read/01ka0zg5bymxjyp1xh84hjsdtg)) ^957317191 use `addOptions` on module and use `@import` in code. - When using the build system to run unit tests, the build runner and the test runner communicate via *stdin* and *stdout* in order to run multiple unit test suites concurrently, and report test failures in a meaningful way without having their output jumbled together. This is one reason why [writing to *standard out* in unit tests is problematic](https://github.com/ziglang/zig/issues/15091) - it will interfere with this communication channel. ([View Highlight](https://read.readwise.io/read/01ka0zndf2njbw0gc9aqn2rsmc)) ^957317511 - In this case it might be a nice adjustment to enable `skip_foreign_checks` for the unit tests ([View Highlight](https://read.readwise.io/read/01ka0zwfjgp92chvdmz5md1b7a)) ^957317995 `skip_foreign_checks` tells Zig “don’t fail just because this binary can’t run on the current host” — it’s a safeguard for multi-target builds and cross-compilation workflows. - Users of `zig build` may use `--search-prefix` to provide additional directories that are considered “system directories” for the purposes of finding static and dynamic libraries. ([View Highlight](https://read.readwise.io/read/01ka0zyptrkyjs412d5pqkbd8j)) ^957318045 - This version of hello world wants to `@embedFile` an asset generated at build time, which we’re going to produce using a tool written in Zig. ([View Highlight](https://read.readwise.io/read/01ka10df2z1xeeq7n9qfk1c576)) ^957322779 `addAnonymousImport`