I tend to build my C/C++ projects on a ram drive (for performance and to avoid unnecessary wear and tear on my persistent storage). I want to keep my sources on persistent storage and only build on the ram drive. I figured one can use
--target-dir to tell cargo to build in a separate directory. However, I would like to be able to set this globally, since I'm likely to want to build everything on the ram drive. A partial solution to this is using the environment variable
CARGO_TARGET_DIR, but this - as far as I can tell - is only used to set the project's build directory, and thus is not appropriate to set globally in
.profile (or similar).
Is there some what to specify cargo variables in
Or rather .. I'm pretty sure there isn't, so what I'm essentially asking is if someone knows of way to accomplish global per-project build directories. (Yes, I realize there are potential issues relating to name collisions).
I saw that one can set the target directory in Cargo.toml, but I don't want to tell others how to build the project -- so I'm looking for a machine-local way to configure build directories. (Plus, my different build systems have their ram drive at different locations).