diff --git a/build.rs b/build.rs index f86dab569..1a0f0d5f0 100644 --- a/build.rs +++ b/build.rs @@ -143,9 +143,9 @@ fn detect_apple(_: &Target) -> Result> { Ok(cfg!(any(target_os = "ios", target_os = "macos"))) } -#[allow(unexpected_cfgs)] fn detect_cygwin(_: &Target) -> Result> { - Ok(cfg!(target_os = "cygwin")) + // Cygwin target is usually cross-compiled. + Ok(std::env::var("CARGO_CFG_TARGET_OS").unwrap() == "cygwin") } /// Detect if we're being compiled for a BSD-derived OS, allowing targeting code conditionally with