Open gnzlbg opened 6 years ago
So the DEBUG
environment variable allows detecting whether in the profile debug={true,false}
, but this does not allow detecting whether -C debuginfo={0,1,2}
was passed via RUSTFLAGS
, .cargo/config
, etc.
I think we should probably add something liek CARGO_DEBUG_LEVEL=1
which is unconditionally set for build scripts which ferries over the 0/1/2 level into build scripts, but currently this is not done for build scripts AFAIK.
To evaluate this, it would help i we had more information on the use case.
Does cargo define an environment variable with its value from the profile ? (I couldn't find any).
If so, is this value updated with the
RUSTFLAGS
/./cargo/config
?The most portable way I can think of, of doing this correctly, is probably to just invoke
cargo metadata
from the build.rs, and just scan it fordebuginfo=PAT
and parse that.