问题
How do I make cargo pass -L
linker flag to rustc invocations?
回答1:
Not yet. However, you can use a custom makefile for given Cargo project instead.
For example, Servo uses the Skia library by having a Rust wrapper in the same cargo project, and a build key that calls a custom makefile.
You can do something similar in this case, for now.
回答2:
It is now possible using .cargo/config
.
See https://github.com/rust-lang/cargo/issues/1109 and http://doc.crates.io/config.html.
来源:https://stackoverflow.com/questions/25978808/how-to-pass-l-linker-flag-to-rustc-for-cargo-based-project