From 75066f6417d1b3f0330f154a09ab15d1e565d79f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 28 Aug 2018 09:32:04 +0300 Subject: [PATCH] Don't append .lib suffix on MSVC builds rustc already does that itself. As such, the only difference between MSVC and other platforms is to skip a couple of libraries that are often wrongly added by pkg-config. --- src/lib.rs | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 3794fdd..88dd310 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -485,28 +485,20 @@ impl Library { self.include_paths.push(PathBuf::from(val)); } "-l" => { - let libname = if is_msvc { - // These are provided by the CRT with MSVC - if ["m", "c", "pthread"].contains(&val) { - continue; - } - - // We need to convert -lfoo to foo.lib for MSVC as that - // is the name of the import library - format!("{}.lib", val) - } else { - val.to_string() - }; + // These are provided by the CRT with MSVC + if is_msvc && ["m", "c", "pthread"].contains(&val) { + continue; + } if statik && is_static_available(val, &dirs) { - let meta = format!("rustc-link-lib=static={}", libname); + let meta = format!("rustc-link-lib=static={}", val); config.print_metadata(&meta); } else { - let meta = format!("rustc-link-lib={}", libname); + let meta = format!("rustc-link-lib={}", val); config.print_metadata(&meta); } - self.libs.push(libname); + self.libs.push(val.to_string()); } "-D" => { let mut iter = val.split("=");