Building multiple projects to the same target directory with Cargo

Hi,

In my project I have several Rust projects building to the same output directory. This makes life much easier for me as these are plugins for the main program (dynamic libs)

My build script looks something like this

cargo build --manifest-path=src/plugin1/plugin1/Cargo.toml
cargo build --manifest-path=src/plugin2/plugin2/Cargo.toml
cargo build --manifest-path=src/main_prog/main_prg/Cargo.toml

In the root of this dir I have a .cargo/config that looks like this

[build]
target-dir = "target"

Building like this works fine and writes everything in the correct output directory but the problem is that the plugins can rebuilt every time I run the script.

The plugins depends on a local crate (looks something like this)


# Depends
[dependencies]
some_lib = { path = "../../some/path" }
```
It looks like this lib gets rebuilt every time when I run the script even if no code/scripts/etc has been changed which ends up building the plugins again. So I wonder if it's supported to have a setup like this?

Cheers!

The CARGO_TARGET_DIR variable will let you override the target directory to get everything to build into the same directory. I use it for doc generation here: https://github.com/sfackler/rust-phf/blob/master/build_docs.sh

Well that is not my problem. As I wrote above everything builds to the correct directory. It's why the code re-compiles while nothing has change I'm wondering about.