Skip to content

Commit f7ddbed

Browse files
committed
Add documentation for CARGO_PRIMARY_PACKAGE
1 parent 6a0a35c commit f7ddbed

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/doc/src/reference/environment-variables.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,12 @@ let out_dir = env::var("OUT_DIR").unwrap();
265265
Currently Cargo doesn't set the `MAKEFLAGS` variable,
266266
but it's free for build scripts invoking GNU Make
267267
to set it to the contents of `CARGO_MAKEFLAGS`.
268+
* `CARGO_PRIMARY_PACKAGE` — This environment variable will be set if the package being
269+
built is primary. Primary packages are the ones the user
270+
selected on the command-line, either with `-p` flags or
271+
the defaults based on the current directory and the default
272+
workspace members.
273+
This environment variable will not be set when building dependencies.
268274
* `CARGO_FEATURE_<name>` — For each activated feature of the package being
269275
built, this environment variable will be present
270276
where `<name>` is the name of the feature uppercased

0 commit comments

Comments
 (0)