]> git.proxmox.com Git - cargo.git/commitdiff
Add docs for RUSTFLAGS and build.rustflags
authorAlex Crichton <alex@alexcrichton.com>
Thu, 17 Mar 2016 00:45:18 +0000 (17:45 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Thu, 17 Mar 2016 00:46:08 +0000 (17:46 -0700)
src/bin/rustc.rs
src/doc/config.md
src/doc/environment-variables.md

index fc4b89790faa0ea521d9b89a54b923ef3e4f5565..aae58dfb81e42a55321d67385a50c4afa71d7c12 100644 (file)
@@ -60,7 +60,9 @@ will simply be added to the compiler invocation.
 
 This command requires that only one target is being compiled. If more than one
 target is available for the current package the filters of --lib, --bin, etc,
-must be used to select which target is compiled.
+must be used to select which target is compiled. To pass flags to all compiler
+processes spawned by Cargo, use the $RUSTFLAGS environment variable or the
+`build.rustflags` configuration option.
 ";
 
 pub fn execute(options: Options, config: &Config) -> CliResult<Option<()>> {
index 8b8bb509089b1f39454d7469656cea15cf5f4384..13370387359af9faed3f8efbd394ecc6a502ab87 100644 (file)
@@ -79,11 +79,12 @@ proxy = "..."     # HTTP proxy to use for HTTP requests (defaults to none)
 timeout = 60000   # Timeout for each HTTP request, in milliseconds
 
 [build]
-jobs = 1               # number of jobs to run by default (default to # cpus)
-rustc = "rustc"        # the rust compiler tool
-rustdoc = "rustdoc"    # the doc generator tool
-target = "triple"      # build for the target triple
-target-dir = "target"  # path of where to place all generated artifacts
+jobs = 1                  # number of jobs to run by default (default to # cpus)
+rustc = "rustc"           # the rust compiler tool
+rustdoc = "rustdoc"       # the doc generator tool
+target = "triple"         # build for the target triple
+target-dir = "target"     # path of where to place all generated artifacts
+rustflags = ["..", ".."]  # custom flags to pass to all compiler invocations
 
 [term]
 verbose = false        # whether cargo provides verbose output
index da9ac20588ae60e9ce4362d654de894de2796b80..8f77b5c9122ffc6aff1afc3be345cc7b6c18df56 100644 (file)
@@ -6,21 +6,27 @@ with them:
 
 # Environment variables Cargo reads
 
-You can override these environment variables to change Cargo's behavior on your system:
+You can override these environment variables to change Cargo's behavior on your
+system:
 
 * `CARGO_HOME` - Cargo maintains a local cache of the registry index and of git
   checkouts of crates.  By default these are stored under `$HOME/.cargo`, but
   this variable overrides the location of this directory. Once a crate is cached
   it is not removed by the clean command.
-* `CARGO_PROFILE` - If this is set to a positive integer *N*, Cargo will record
-  timing data as it runs.  When it exits, it will print this data as a profile
-  *N* levels deep.
 * `CARGO_TARGET_DIR` - Location of where to place all generated artifacts,
   relative to the current working directory.
 * `RUSTC` - Instead of running `rustc`, Cargo will execute this specified
   compiler instead.
 * `RUSTDOC` - Instead of running `rustdoc`, Cargo will execute this specified
   `rustdoc` instance instead.
+* `RUSTFLAGS` - A space-separated list of custom flags to pass to all compiler
+  invocations that Cargo performs. In contrast with `cargo rustc`, this is
+  useful for passing a flag to *all* compiler instances.
+
+Note that Cargo will also read environment variables for `.cargo/config`
+configuration values, as described in [that documentation][config-env]
+
+[config-env]: config.html#environment-variables
 
 # Environment variables Cargo sets for crates