0

How to output the binary to the target directory of the current project after setting build.target-dir?

Currently, all binaries are output to build.target-dir.

I know there is the sccache tool, but it still builds and uses more disk space.

I have two projects with the same name:

/dir1/my-rust
/dir2/my-rust

After compiling both projects, I will only get one "my-rust" binary file.

I want them to be outputted to their respective projects:

/dir1/my-rust/target/release/my-rust
/dir2/my-rust/target/release/my-rust
0x01
  • 1
  • 1

1 Answers1

-1

cargo build has a --target-dir argument. For example, cargo build --taget-dir ./target/ or cargo build --target-dir /some/special/dir.

user16217248
  • 3,119
  • 19
  • 19
  • 37
salmon
  • 31
  • 4