#build-dependencies #pcap #flags #find #libpcap #linker #compiler

build pcap-config

A library to run the pcap-config tool at build time to find the compiler flags for linking libpcap

2 releases

Uses old Rust 2015

0.1.1 Jan 5, 2016
0.1.0 Jan 4, 2016

#608 in Build Utils

Custom license

5KB
59 lines

pcap-config Build Status

A simple library designed to be used as a build dependency to determine the location and flags required to use libpcap from a Cargo project. Made because libpcap doesn't come with a pkg-config file and does include the pcap-config executable to accomplish the same goal. Inspired by alexcrichton/pkg-config-rs.

Each successful commit on master regenerates the documentation.

extern crate pcap_config;

fn main() {
    pcap_config::find_library().unwrap();
}

lib.rs:

A build dependency for Cargo projects to find the location and compiler flags for linking against libpcap using the pcap-config utility.

This library uses the pcap-config utility, which is installed with libpcap, to find the location and compiler flags required by cargo for linking to libpcap. A Config structure provides a way to customize the options set for running pcap-config.

If pcap-config runs successfully, the Cargo metadata is printed to stdout.

Examples

Using pcap-config with the default options:

extern crate pcap_config;

fn main() {
    pcap_config::find_library().unwrap();
}

Customizing how pcap-config reports the metadata:

extern crate pcap_config;

fn main() {
    pcap_config::Config::new().statik(true).find().unwrap();
}

No runtime deps