Crate rustc_cfg [] [src]

rustc --print cfg parser (usable in build.rs scripts)

Requirements

  • This crate depends on rustc >=1.8.0.

How to use

// build.rs
extern crate rustc_cfg;

use std::env;

use rustc_cfg::Cfg;

fn main() {
    let cfg = Cfg::new(env::var_os("TARGET").unwrap()).unwrap();

    if cfg.target_arch == "arm" {
         // don't compile this or that C file
    }
}

Structs

Cfg

Parsed rustc --print cfg