Skip to content

Set the CARGO_BIN_NAME environment variable also when building (binary) examples #11689

Closed
@t-rapp

Description

@t-rapp

Problem

The CARGO_BIN_NAME environment variable is useful when building command-line programs (see #8251). It lets the command know its binary name for printing out simple usage instructions.

Currently CARGO_BIN_NAME is only set when building a [[bin]] target, though. In my projects a lot of the examples are wrappers around functions of a library crate to allow testing with custom data, similar to small command-line programs. In those example binaries CARGO_BIN_NAME is not available during compilation.

Proposed Solution

It would be useful to also set the CARGO_BIN_NAME environment variable for (binary) examples.

Notes

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-environment-variablesArea: environment variablesC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-acceptedStatus: Issue or feature is accepted, and has a team member available to help mentor or reviewT-cargoTeam: Cargo

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions