ENV-vars set in build-script not available from dev-dependencies?

Hi there,

based on this documentation: Cargo Environment Variables, together with this I'm able to simply use a build script to pass specific environment variables from a direct dependent crate to another one with the format DEP_<crates_links_name>.

However, if the dependent crate is part of the dev-dependencies section in the cargo.toml file this does not seem to work. Is this by intention? My use case is, that I'd like to use the dependency in question only for unit and integration tests but would require to know the contents of a specific env-var this dependent crate sets during its build script execution. I tried to find a solution on my own but without any success. So any guidance would be much appreciated.

Btw: If I use the dependent crate as "normal" dependency the required env-var is properly set, but I really like to avoid this!

Thx in advance.

This might be a bug. You should probably create a ticket against the cargo repo so they can clarify it.

Thanks for the feedback.
For others as reference: GitHub-Issue

1 Like

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.