I want to have a separated build script (in rust) for my program. The folder structure is like this
|- build
|--- build.rs
|--- Cargo.toml
|- src
|--- main.rs
|- Cargo.toml
My outside Cargo.toml
is like this
[package]
name = "test"
version = "0.1.0"
edition = "2021"
[workspace]
members = ["build"]
And my Cargo.toml inside the build
folder is like this:
[package]
name = "build"
version = "0.1.0"
authors = []
publish = false
[dependencies]
cargo_metadata = "0.15.2"
[[bin]]
name = "build"
path = "build.rs"
Simple enough?
However, upon running cargo run --package build --bin build
, I got hit with:
--> build\build.rs:1:1
|
1 | extern crate cargo_metadata;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
I have been wasting more than 1 hour on this. Please help :(((((((
Thank you.