aboutsummaryrefslogtreecommitdiffhomepage
path: root/detours-sys/build.rs
diff options
context:
space:
mode:
Diffstat (limited to 'detours-sys/build.rs')
-rw-r--r--detours-sys/build.rs25
1 files changed, 10 insertions, 15 deletions
diff --git a/detours-sys/build.rs b/detours-sys/build.rs
index f3da0e6..20bb342 100644
--- a/detours-sys/build.rs
+++ b/detours-sys/build.rs
@@ -1,10 +1,8 @@
-use std::error::Error;
-
#[cfg(not(target_os = "windows"))]
fn main() {}
#[cfg(target_os = "windows")]
-fn main() -> Result<(), Box<dyn Error>> {
+fn main() -> Result<(), Box<dyn std::error::Error>> {
windows::main_impl()
}
@@ -37,18 +35,15 @@ mod windows {
.try_compile("detours")?;
Ok(())
}
-
- #[cfg(target_env = "msvc")]
- fn add_target_options(build: &mut cc::Build) -> &mut cc::Build {
- build
- }
-
- #[cfg(not(target_env = "msvc"))]
fn add_target_options(build: &mut cc::Build) -> &mut cc::Build {
- build
- .compiler("clang")
- .cpp(true)
- .flag("-fms-extensions")
- .flag("-Wno-everything")
+ if std::env::var("CARGO_CFG_TARGET_ENV").unwrap() != "msvc" {
+ build
+ .compiler("clang")
+ .cpp(true)
+ .flag("-fms-extensions")
+ .flag("-Wno-everything")
+ } else {
+ build
+ }
}
}