Skip to content

Commit

Permalink
Merge pull request #72 from sdroege/msvc-suffix
Browse files Browse the repository at this point in the history
Don't append .lib suffix on MSVC builds
  • Loading branch information
alexcrichton authored Aug 28, 2018
2 parents 2fe00e1 + 75066f6 commit c350a0b
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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("=");
Expand Down

0 comments on commit c350a0b

Please sign in to comment.