macro_rules! target_cfg {
    (
        @emit
        all
        $({$($grouped:tt)+})+
    ) => { ... };
    (
        @emit
        any
        $({$($grouped:tt)+})+
    ) => { ... };
    (
        @clause
        $op:ident
        [$({$($grouped:tt)+})*]
        [, $($rest:tt)*]
        $($current:tt)+
    ) => { ... };
    (
        @clause
        $op:ident
        [$({$($grouped:tt)+})*]
        [$tok:tt $($rest:tt)*]
        $($current:tt)*
    ) => { ... };
    (
        @clause
        $op:ident
        [$({$($grouped:tt)+})*]
        []
        $($current:tt)+
    ) => { ... };
    (
        all($($tokens:tt)+)
    ) => { ... };
    (
        any($($tokens:tt)+)
    ) => { ... };
    (
        not($($tokens:tt)+)
    ) => { ... };
    (
        $e:tt = $v:expr
    ) => { ... };
}
Expand description

Test for characteristics of the target machine.

Unlike the standard cfg! macro, this macro will give correct results when cross-compiling in a build.rs script. It attempts, but is not guaranteed, to emulate the syntax of the cfg! macro. Note, however, that the result of the macro must be evaluated at runtime, not compile-time.

Supported syntaxes:

target_cfg!(target_os = "macos");
target_cfg!(not(target_os = "macos"));
target_cfg!(any(target_os = "macos", target_endian = "big"));
target_cfg!(all(target_os = "macos", target_endian = "big"));
target_cfg!(all(target_os = "macos", not(target_endian = "big")));