= cargo-build(1)
:idprefix: cargo_build_
:doctype: manpage
:actionverb: Build

== NAME

cargo-build - Compile the current package

== SYNOPSIS

`cargo build [_OPTIONS_]`

== DESCRIPTION

Compile local packages and all of their dependencies.

== OPTIONS

=== Package Selection

include::options-packages.adoc[]

=== Target 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.

include::options-targets.adoc[]

include::options-features.adoc[]

=== Compilation Options

include::options-target-triple.adoc[]

include::options-release.adoc[]

=== Output Options

include::options-target-dir.adoc[]

*--out-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.

=== Display Options

include::options-display.adoc[]

include::options-message-format.adoc[]

*--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.

=== Manifest Options

include::options-manifest-path.adoc[]

include::options-locked.adoc[]

=== Common Options

include::options-common.adoc[]

=== Miscellaneous Options

include::options-jobs.adoc[]

include::section-profiles.adoc[]

include::section-environment.adoc[]

include::section-exit-status.adoc[]

== EXAMPLES

. Build the local package and all of its dependencies:

    cargo build

. Build with optimizations:

    cargo build --release

== SEE ALSO
man:cargo[1], man:cargo-rustc[1]
