EDIT: Turns out CARGO_PKG_NAME
does exactly what I need, and I had just misread the output of my debugging. Unfortunately I seem unable to delete this post.
When specifying a custom build script, the CARGO_PKG_NAME
environment variable holds the name of the top-level crate being built. Is there a way to get the name of the current crate being built? Concretely, if crate foo
depends on crate bar
, and bar
has a build script, is there a way for that build script to discover that it's being run on crate with the name bar
?
This may sound like an odd question, but I'm trying to write a generic build.rs
script that performs a particular task for any crate.