pkg-config 0.2.0

A library to run the pkg-config system tool at build time in order to be used in Cargo build scripts.
docs.rs failed to build pkg-config-0.2.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: pkg-config-0.3.19

A build dependency for Cargo libraries to find system artifacts through the pkg-config utility.

This library will shell out to pkg-config as part of build scripts and probe the system to determine how to link to a specified library. The Config structure serves as a method of configuring how pkg-config is invoked in a builder style.

A number of environment variables are available to globally configure how this crate will invoke pkg-config:

  • PKG_CONFIG_ALLOW_CROSS - if this variable is not set, then pkg-config will automatically be disabled for all cross compiles.
  • FOO_NO_PKG_CONFIG - if set, this will disable running pkg-config when probing for the library named foo.

There are also a number of environment variables which can configure how a library is linked to (dynamically vs statically). These variables control whether the --static flag is passed. Note that this behavior can be overridden by configuring explicitly on Config. The variables are checked in the following order:

  • FOO_STATIC - pass --static for the library foo
  • FOO_DYNAMIC - do not pass --static for the library foo
  • PKG_CONFIG_ALL_STATIC - pass --static for all libraries
  • PKG_CONFIG_ALL_DYNAMIC - do not pass --static for all libraries

After running pkg-config all appropriate Cargo metadata will be printed on stdout if the search was successful.

Example

Find the system library named foo.

extern crate "pkg-config" as pkg_config;

fn main() {
    pkg_config::find_library("foo").unwrap();
}

Configure how library foo is linked to.

extern crate "pkg-config" as pkg_config;

fn main() {
    pkg_config::Config::new().statik(true).find("foo").unwrap();
}