[rust-dev] Cargo multiple targets
s.gesemann at gmail.com
Wed Jul 2 04:37:58 PDT 2014
On Wed, Jul 2, 2014 at 12:49 PM, Isak Andersson wrote:
> Hello Rust folks!
> I am using Cargo and I am trying to specify mulitple targets in my
> Cargo.toml file.
> First of all is this even possible?
> name = "hmproof"
> version = "0.1.0"
> authors = [ "isak at houstonmedia.se" ]
> name = "hmwhoami"
> name = "proof"
> (I also tried adding a path)
> path = "src/proof.rs"
> git = "https://github.com/chris-morgan/rust-http.git"
> I also tried putting the [[lib]] part after the dependencies part. The error
> I get is this:
> error: couldn't read src/bin/hmwhoami.rs: couldn't open file (no such file
> or directory [...]
> Whiich doesn't make any sense at all to me. Why does it suddenly start
> looking in src/bin?
According to http://crates.io/manifest.html the default path for a
binary is src (if there is no other lib) and src/bin (if there is also
a lib target). You should be able to override this with path =
> Do I have to put my bin code in src/bin and my lib code in src lib or what?
Currently, only a single lib per package is supported and it seems,
judging by the document about the manifest format, that Cargo always
looks for src/lib.rs for a library unless you override this using a
As for how to tell Cargo to invoke rustc with the appropriate -L
option: I don't know.
More information about the Rust-dev