summaryrefslogtreecommitdiffstats
path: root/third_party/rust/error-chain/build.rs
blob: 612f2091de4b56e8949465b697c2a0a8f900c854 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
extern crate version_check;

use std::env;
use version_check::is_min_version;

fn main() {
    // Switch on for versions that have Error::source
    // As introduced by https://github.com/rust-lang/rust/pull/53533
    if is_min_version("1.30").unwrap_or(false) {
        println!("cargo:rustc-cfg=has_error_source");
    }

    if is_min_version("1.42").unwrap_or(false) {
        println!("cargo:rustc-cfg=has_error_description_deprecated");
    }

    // So we can get the build profile for has_backtrace_depending_on_env test
    if let Ok(profile) = env::var("PROFILE") {
        println!("cargo:rustc-cfg=build={:?}", profile);
    }
}