build#
Configure (if needed) and build the project.
clibra build --preset debug
clibra build --preset debug --target mylib # build one target
clibra build --preset release --lto # build with LTO
On first run, clibra detects that no build directory exists and runs
the configure step automatically. Subsequent runs skip configure unless
inputs have changed. CMake’s internal re-run mechanism handles incremental
reconfigures transparently.
--target restricts the build to a single CMake target. -v/--verbose
prints the underlying build commands. -j/--jobs sets the parallel job
count (defaults to the logical CPU count).
Configure-time defines#
-D VAR=VALUE values are forwarded to the configure step, but only when
a configure actually runs. If the build directory already exists and
neither --reconfigure nor --fresh is given, passing -D values
is treated as a configuration error and the command aborts rather than
silently ignoring them.
LTO#
--lto enables link-time optimization by appending LIBRA_LTO=YES to
the configure step, and --no-lto disables it, without requiring a
dedicated LTO preset. Either flag triggers a reconfigure only when the
requested LTO state differs from what the existing cache already holds, so
repeated builds with the same flag do not needlessly reconfigure.
CMake equivalent#
Cold start (no build directory):
cmake --preset <name> [-D VAR=VALUE ...]
cmake --build --preset <name> --parallel <N>
Incremental:
cmake --build --preset <name> --parallel <N> [--target <t>] [--clean-first] [--verbose]
Situation |
What |
|---|---|
Build directory absent |
Runs configure, then build. |
Build directory present, inputs unchanged |
Runs build only. |
Build directory present, |
Always runs configure, then build. |
|
Runs |
|
Runs build with |
|
Reconfigures with |
|
Aborts with an error (defines would be ignored). |
Flag reference#
clibra build#
Configure (if needed) and build the project
Usage: clibra build [OPTIONS]
Options:#
-j,--jobs <JOBS>— Parallel job count. Defaults to the # of logical CPUsDefault value:
4-t,--target <TARGET>— Build a specific CMake target--clean— Pass –clean-first to cmake –build-k,--keep-going— Continue building after errors. Only valid with {Ninja, Unix Makefiles} generators-D <VAR=VALUE>— Forward -DVAR=VALUE to the CMake configure step when active. If the build directory exists and neither –reconfigure nor –fresh is given, abort-r,--reconfigure— Force the configure step even if the build directory exists-f,--fresh— Reconfigure with a –fresh build directory by wiping the CMake cache-v,--verbose— Run the build in verbose mode, printing build commands--lto— Enable LTO via LIBRA