Reputation: 6994
How can I access the generated foo
binary when I have this in my Cargo.toml?
[[bin]]
name = "foo"
path = "src/foo.rs"
Ideally I would like to have something which works like
make install DESTDIR=$(pwd)/i
I tried:
cargo build --out-dir $(pwd)/i
--> fails with "error: the --out-dir
flag is unstable"
cargo install --path . --root $(pwd)/i
--> comes near to the result, but it seems to be impossible to set flags like --release
or its opposite variant (yes, I want the debug binary!)
OUT_DIR=$(pwd)/i cargo build
--> does not seem to have any effect as there is no directory generated
I could dig into the target directory, but there are a lot of unwanted files so globs will not work and I will have to know exactly the artifact name, including automatic suffices like .a
, .so
, .so.1.2.3
, etc.
Upvotes: 2
Views: 3344
Reputation: 141698
How to access binaries built by cargo?
The cargo install --path . --root $(pwd)/i
is the correct way to specify the destination installation directory.
but it seems to be impossible to set flags like --release or its opposite variant (yes: I want the debug binary!)
It's possible with the --debug
flag.
cargo install --debug --path . --root $(pwd)/i
See cargo install manual.
Upvotes: 5