diff --git a/crates/targets/aarch64_msvc/build.rs b/crates/targets/aarch64_msvc/build.rs index 243d23c4f9..e1cd062f3f 100644 --- a/crates/targets/aarch64_msvc/build.rs +++ b/crates/targets/aarch64_msvc/build.rs @@ -1,6 +1,8 @@ fn main() { - let target = std::env::var("TARGET").unwrap(); - if target != "aarch64-pc-windows-msvc" && target != "aarch64-uwp-windows-msvc" { + let family = std::env::var("CARGO_CFG_TARGET_FAMILY").unwrap(); + let arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap(); + let env = std::env::var("CARGO_CFG_TARGET_ENV").unwrap(); + if family != "windows" || arch != "aarch64" || env != "msvc" { return; } diff --git a/crates/targets/i686_msvc/build.rs b/crates/targets/i686_msvc/build.rs index 53892bff6b..0c00b792eb 100644 --- a/crates/targets/i686_msvc/build.rs +++ b/crates/targets/i686_msvc/build.rs @@ -1,6 +1,8 @@ fn main() { - let target = std::env::var("TARGET").unwrap(); - if target != "i686-pc-windows-msvc" && target != "i686-uwp-windows-msvc" { + let family = std::env::var("CARGO_CFG_TARGET_FAMILY").unwrap(); + let arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap(); + let env = std::env::var("CARGO_CFG_TARGET_ENV").unwrap(); + if family != "windows" || arch != "x86" || env != "msvc" { return; } diff --git a/crates/targets/x86_64_msvc/build.rs b/crates/targets/x86_64_msvc/build.rs index c51c8caa81..ae819b9759 100644 --- a/crates/targets/x86_64_msvc/build.rs +++ b/crates/targets/x86_64_msvc/build.rs @@ -1,6 +1,8 @@ fn main() { - let target = std::env::var("TARGET").unwrap(); - if target != "x86_64-pc-windows-msvc" && target != "x86_64-uwp-windows-msvc" { + let family = std::env::var("CARGO_CFG_TARGET_FAMILY").unwrap(); + let arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap(); + let env = std::env::var("CARGO_CFG_TARGET_ENV").unwrap(); + if family != "windows" || arch != "x86_64" || env != "msvc" { return; }