Skip to content

Commit

Permalink
CRT_STATIC should be an optional env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
analyzeDFIR committed Jul 6, 2021
1 parent 358e6c7 commit c3f063e
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions lz4-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,15 @@ fn run() -> Result<(), Box<dyn Error>> {
if target == "i686-pc-windows-gnu" {
// Disable auto-vectorization for 32-bit MinGW target.
compiler.flag("-fno-tree-vectorize");
} else if get_from_env("CRT_STATIC")?.to_uppercase() == "TRUE" {
// Must supply the /MT compiler flag to use the multi-threaded, static VCRUNTIME library
// when building on Windows. Cargo does not pass RUSTFLAGS to build scripts
// (see: https://github.com/rust-lang/cargo/issues/4423) so we must use a custom env
// variable "CRT_STATIC."
compiler.static_crt(true);
}
if let Ok(value) = get_from_env("CRT_STATIC") {
if value.to_uppercase() == "TRUE" {
// Must supply the /MT compiler flag to use the multi-threaded, static VCRUNTIME library
// when building on Windows. Cargo does not pass RUSTFLAGS to build scripts
// (see: https://github.com/rust-lang/cargo/issues/4423) so we must use a custom env
// variable "CRT_STATIC."
compiler.static_crt(true);
}
}
}
compiler.compile("liblz4.a");
Expand Down

0 comments on commit c3f063e

Please sign in to comment.