Get cargo variables for scripts

Is there a way to tell cargo to print its effective variables like target-dir?

I want to do something along the line of:


BLDDIR="$(cargo what-is target-dir)"

cd mytest
cargo build --target <blah>
cp $BLDDIR/<blah>/mytest.wasm ../static/

I have target-dir set globally on some systems to build in a RAM drive, and on other systems I don't override the default -- so I need to be able to figure out where the targets end up for my script.

Set and check the environment variable CARGO_TARGET_DIR.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.