From de81c504b187279e6daba30df9673835f7f6c1eb Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 7 Dec 2021 01:17:50 -0700 Subject: [PATCH] CLI: allow `-femit-implib` when building .exe files too --- src/main.zig | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main.zig b/src/main.zig index 54adf80fa6..c29a272660 100644 --- a/src/main.zig +++ b/src/main.zig @@ -2237,11 +2237,14 @@ fn buildOutputType( }; defer emit_docs_resolved.deinit(); - const is_dyn_lib = switch (output_mode) { - .Obj, .Exe => false, + const is_exe_or_dyn_lib = switch (output_mode) { + .Obj => false, .Lib => (link_mode orelse .Static) == .Dynamic, + .Exe => true, }; - const implib_eligible = is_dyn_lib and + // Note that cmake when targeting Windows will try to execute + // zig cc to make an executable and output an implib too. + const implib_eligible = is_exe_or_dyn_lib and emit_bin_loc != null and target_info.target.os.tag == .windows; if (!implib_eligible) { if (!emit_implib_arg_provided) {