{{~*set command=“build”}} {{~*set actionverb=“Build”}} {{~*set multitarget=true}}
cargo-build --- Compile the current package
cargo build [options]
Compile local packages and all of their dependencies.
{{> section-package-selection }}
When no target selection options are given, cargo build will build all binary and library targets of the selected packages. Binaries are skipped if they have required-features that are missing.
{{> options-targets-bin-auto-built }}
{{> options-targets }}
{{> section-features }}
{{> options-target-triple }}
{{> options-release }}
{{> options-profile }}
{{> options-timings }}
{{/options}}
{{#option “--artifact-dir directory” }} Copy final artifacts to this directory.
This option is unstable and available only on the nightly channel and requires the -Z unstable-options flag to enable. See https://github.com/rust-lang/cargo/issues/6790 for more information. {{/option}}
{{/options}}
{{> options-message-format }}
{{#option “--build-plan” }} Outputs a series of JSON messages to stdout that indicate the commands to run the build.
This option is unstable and available only on the nightly channel and requires the -Z unstable-options flag to enable. See https://github.com/rust-lang/cargo/issues/5579 for more information. {{/option}} {{/options}}
{} {{> options-manifest-path }}
{{> options-ignore-rust-version }}
{{> options-locked }}
{{> options-lockfile-path }} {{/options}}
{{> section-options-common }}
{} {{> options-jobs }} {{> options-keep-going }} {{> options-future-incompat }} {{/options}}
{{> section-environment }}
{{> section-exit-status }}
Build the local package and all of its dependencies:
cargo build
Build with optimizations:
cargo build --release
{{man “cargo” 1}}, {{man “cargo-rustc” 1}}