A simple library meant to be used as a build dependency with Cargo packages in
order to use the system pkg-config
tool (if available) to determine where a
library is located.
You can use this crate directly to probe for specific libraries, or use
metadeps to declare all your
pkg-config
dependencies in Cargo.toml
.
This library requires Rust 1.13+.
Find the system library named foo
, with minimum version 1.2.3:
```rust extern crate pkg_config;
fn main() { pkgconfig::Config::new().atleastversion("1.2.3").probe("foo").unwrap(); } ```
Find the system library named foo
, with no version requirement (not
recommended):
```rust extern crate pkg_config;
fn main() { pkgconfig::probelibrary("foo").unwrap(); } ```
In cross-compilation context, it is useful to manage separately PKGCONFIGPATH
and a few other variables for the host
and the target
platform.
The supported variables are: PKG_CONFIG_PATH
, PKG_CONFIG_LIBDIR
, and
PKG_CONFIG_SYSROOT_DIR
.
Each of these variables can also be supplied with certain prefixes and suffixes, in the following prioritized order:
<var>_<target>
- for example, PKG_CONFIG_PATH_x86_64-unknown-linux-gnu
<var>_<target_with_underscores>
- for example, PKG_CONFIG_PATH_x86_64_unknown_linux_gnu
<build-kind>_<var>
- for example, HOST_PKG_CONFIG_PATH
or TARGET_PKG_CONFIG_PATH
<var>
- a plain PKG_CONFIG_PATH
Also note that PKG_CONFIG_ALLOW_CROSS
must always be set in cross-compilation context.
This project is licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Serde by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.