Skip to content

Commit 8127db1

Browse files
authored
MSVC: Add LIB var when compiling flag_check (#1417)
1 parent 439b75f commit 8127db1

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/lib.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1357,11 +1357,15 @@ impl Build {
13571357

13581358
cmd.arg(&src);
13591359

1360-
// On MSVC skip the CRT by setting the entry point to `main`.
1361-
// This way we don't need to add the default library paths.
13621360
if compiler.is_like_msvc() {
1363-
// Flags from _LINK_ are appended to the linker arguments.
1364-
cmd.env("_LINK_", "-entry:main");
1361+
// On MSVC we need to make sure the LIB directory is included
1362+
// so the CRT can be found.
1363+
for (key, value) in &tool.env {
1364+
if key == "LIB" {
1365+
cmd.env("LIB", value);
1366+
break;
1367+
}
1368+
}
13651369
}
13661370

13671371
let output = cmd.current_dir(out_dir).output()?;

0 commit comments

Comments
 (0)