From 94db2d127a51d5b17d389dc29055c2df24314ec6 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 29 Nov 2017 23:32:28 +0300 Subject: [PATCH] Document that cargo sets `CARGO` for build scripts --- src/doc/book/src/reference/environment-variables.md | 1 + src/doc/environment-variables.md | 1 + tests/build-script.rs | 2 ++ 3 files changed, 4 insertions(+) diff --git a/src/doc/book/src/reference/environment-variables.md b/src/doc/book/src/reference/environment-variables.md index e95b79d6c..08d2adaa8 100644 --- a/src/doc/book/src/reference/environment-variables.md +++ b/src/doc/book/src/reference/environment-variables.md @@ -73,6 +73,7 @@ let out_dir = env::var("OUT_DIR").unwrap(); `out_dir` will now contain the value of `OUT_DIR`. +* `CARGO` - Path to the `cargo` binary performing the build. * `CARGO_MANIFEST_DIR` - The directory containing the manifest for the package being built (the package containing the build script). Also note that this is the value of the diff --git a/src/doc/environment-variables.md b/src/doc/environment-variables.md index 6fe532d61..f8b168401 100644 --- a/src/doc/environment-variables.md +++ b/src/doc/environment-variables.md @@ -73,6 +73,7 @@ let out_dir = env::var("OUT_DIR").unwrap(); `out_dir` will now contain the value of `OUT_DIR`. +* `CARGO` - Path to the `cargo` binary performing the build. * `CARGO_MANIFEST_DIR` - The directory containing the manifest for the package being built (the package containing the build script). Also note that this is the value of the diff --git a/tests/build-script.rs b/tests/build-script.rs index 0748b44ca..3644235a3 100644 --- a/tests/build-script.rs +++ b/tests/build-script.rs @@ -103,6 +103,8 @@ fn custom_build_env_vars() { let _feat = env::var("CARGO_FEATURE_FOO").unwrap(); + let _cargo = env::var("CARGO").unwrap(); + let rustc = env::var("RUSTC").unwrap(); assert_eq!(rustc, "rustc"); -- 2.39.5