Commit de81c504b1

Andrew Kelley <andrew@ziglang.org>
2021-12-07 09:17:50
CLI: allow `-femit-implib` when building .exe files too
1 parent 0812b57
Changed files (1)
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) {