Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Make cargo export `CARGO_TARGET_DIR` to `build.rs` scripts #7325
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Eh2406 (or someone else) soon.
If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.
Please see the contribution instructions for more information.
so i can try to describe my use-case but it's not unlike what people describe here: #5457
for my purpose, an alternate solution might be, instead make it so that
and that would tell cargo that something that we produced and placed in
it's less immediately obvious to me how to write that patch though, but it also can't be that hard, i guess it's probably even in the same
afaik the only reason to do that instead of this is if there is some abstraction layer you don't want to break for some reason about build scripts and
but I can't see what that would be, and the target dir is removed by
anyways would love to hear what you think
Thanks for the PR here @cbeck88, but the first thing that needs to be covered is whether the Cargo team thinks this should happen. Build scripts are intended to have a very scoped output (just in their
Now that's not to say that this can't happen, but this needs to be considered carefully. For example how would dependencies make use of this? Should this only be set for the "final package"? Is this really all that's necessary for installation? (etc, etc)
I'm going to go ahead and close this because I don't think this feature is fleshed out enough yet. I think that this still wants discussion to figure out the best way forward and how Cargo can cater to the use cases mentioned here and in #5457, and I don't think setting this one environment variable is going to be the full fix.