Skip to content

Commit

Permalink
MSVC: Add LIB var when compiling flag_check (#1417)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisDenton authored Feb 26, 2025
1 parent 439b75f commit 8127db1
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1357,11 +1357,15 @@ impl Build {

cmd.arg(&src);

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

let output = cmd.current_dir(out_dir).output()?;
Expand Down

0 comments on commit 8127db1

Please sign in to comment.