Skip to content

Commit 05a529c

Browse files
authored
Fix is_flag_supported on msvc (#1336)
1 parent e758ed1 commit 05a529c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/lib.rs

+7
Original file line numberDiff line numberDiff line change
@@ -727,6 +727,13 @@ impl Build {
727727

728728
cmd.arg(&src);
729729

730+
// On MSVC skip the CRT by setting the entry point to `main`.
731+
// This way we don't need to add the default library paths.
732+
if compiler.is_like_msvc() {
733+
// Flags from _LINK_ are appended to the linker arguments.
734+
cmd.env("_LINK_", "-entry:main");
735+
}
736+
730737
let output = cmd.output()?;
731738
let is_supported = output.status.success() && output.stderr.is_empty();
732739

0 commit comments

Comments
 (0)