I'm currently struggeling with building crates that are part of a workspace.
Assume the following structure:
workspace ├─ subfolder │ └─ crate │ ├─ src │ │ └─ main.rs │ └─ cargo.tom └─ cargo.toml
subfolder/crateis part of the
workspace/cargo.toml like so:
[workspace] members = ["subfolder/crate"]
The base path for
rustcinvokations is the
workspace folder, even when
cargo buildis executed from within this
Running rustc --edition=2018 --crate-name kernel 'subfolder\crate\./src/main.rs'
On the contrary, if the crate is excluded from the workspace like so:
[workspace] exclude = ["subfolder/crate"]
The crates folder is the base path of invocation:
Running rustc --edition=2018 --crate-name kernel /src/main.rs
Is this by intention, and if so, may I ask why? And also I'd like to know how could I force the base path of invocation to always be the path cargo build has been executed in ?
The reason for this need is, that I pass additional RUSTFLAGS to the build containing a relative path to my linker script file like so
-C link-arg=-T./link.ld. This file is located in the crates folder not in the workspace folder, so based on the invokation base path this file could be found or not ....
Any suggestions are very welcome.
Thanks in advance.