-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Open
Labels
A-environment-variablesArea: environment variablesArea: environment variablesC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-needs-team-inputStatus: Needs input from team on whether/how to proceed.Status: Needs input from team on whether/how to proceed.
Description
Problem
Cargo allows for building libraries having different name than the crate name (name
field on [package]
) via the name
field on [lib]
, such as given the following manifest, crate name will be goodname
but built library will be named libothername.so
or so.
[packege]
name = "goodname"
version = "0.1.0"
edition = "2021"
[lib]
name = "othername"
crate-type = ["cdylib"]
For binaries, we have CARGO_BIN_NAME
being populated with similar target name for binary on tests etc, but we do not have the equivalent of it for libraries, thus my request is to have CARGO_LIB_NAME
, or any suitable variable name that will be populated with the target library name, having same behavior as CARGO_BIN_NAME
.
Proposed Solution
Add an env var CARGO_LIB_NAME
to be populated with the value set on name
field on [lib]
, if set or default to package name.
Notes
Ref:
- name field on target
- Environment variable to identify the binary name #8251 Environment variable to identify the binary name
- Cargo allows you to have a different name in
[lib]
and[package]
when publishing #6827 Cargo allows you to have a different name in [lib] and [package] when publishing
sammysheep
Metadata
Metadata
Assignees
Labels
A-environment-variablesArea: environment variablesArea: environment variablesC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-needs-team-inputStatus: Needs input from team on whether/how to proceed.Status: Needs input from team on whether/how to proceed.