Crates.io | system-deps |
lib.rs | system-deps |
version | 7.0.3 |
source | src |
created_at | 2020-06-19 13:04:20.470011 |
updated_at | 2024-09-22 13:36:33.807552 |
description | Discover and configure system dependencies from declarative dependencies in Cargo.toml |
homepage | |
repository | https://github.com/gdesmott/system-deps |
max_upload_size | |
id | 255690 |
size | 135,672 |
system-deps
lets you write system dependencies in Cargo.toml
metadata,
rather than programmatically in build.rs
. This makes those dependencies
declarative, so other tools can read them as well.
For now only pkg-config
dependencies are supported, but we are planning to
expand it at some point.
Users can override dependency flags using environment variables if needed.
system-deps
also allows -sys
crates to optionally internally build and
static link the required system library.
system-deps
has been started as a fork of the
metadeps project.
See the crate documentation.
In your Cargo.toml
:
[build-dependencies]
system-deps = "2.0"
Then, to declare a dependency on testlib >= 1.2
add the following section:
[package.metadata.system-deps]
testlib = "1.2"
Finally, in your build.rs
, add:
fn main() {
system_deps::Config::new().probe().unwrap();
}
See the crate documentation for more advanced features.