Skip to content

Commit

Permalink
Disable pkg-config on MSVC
Browse files Browse the repository at this point in the history
Closes #58
  • Loading branch information
alexcrichton committed Dec 9, 2019
1 parent 22ed2bb commit 052668e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lzma-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@ fn main() {

println!("cargo:rerun-if-env-changed=LZMA_API_STATIC");
let want_static = env::var("LZMA_API_STATIC").is_ok();
if !want_static && pkg_config::probe_library("liblzma").is_ok() {
let msvc = target.contains("msvc");

// If a static link is desired, we compile from source.
// If we're compiling for MSVC, pkg-config runs a risk of picking up MinGW
// libraries by accident, so disable it.
//
// Otherwise check the system to see if it has an lzma library already
// installed that we can use.
if !want_static && !msvc && pkg_config::probe_library("liblzma").is_ok() {
return;
}

Expand Down

0 comments on commit 052668e

Please sign in to comment.