xx
.md

cmake_build

cmake_build runs the native build tool through the managed CMake installation. The build runs during xx run; pass its returned dependency to tasks that need the built artifacts.

Arguments

ArgumentRequiredDescription
generationYesMatching dependency returned by cmake_generate; selects the build directory and orders generation before building.
targetsNoBuild targets passed with --target. An empty list builds the default target. Defaults to [].
configNoConfiguration passed with --config for multi-configuration generators, such as "Release".
parallelNoPositive number of parallel build jobs passed with --parallel.
clean_firstNoClean before building the selected targets. Defaults to False.
verboseNoPrint the underlying build commands. Defaults to False.
depsNoDependencies activated before building, in list order. Defaults to [].

The managed CMake installation is automatic; do not add cmake or generation to deps. The build directory must remain inside the project and contain a generated CMakeCache.txt after dependencies finish.

Builds using the same generation are automatically serialized in declaration order so they cannot mutate the build tree concurrently.

Example

load("@[email protected]", "cmake_build", "cmake_generate")
load("@[email protected]", "ninja")

configure = cmake_generate(
    generator="Ninja",
    build_type="Release",
    deps=[ninja],
)

build = cmake_build(
    configure,
    targets=["app"],
    parallel=8,
)