Commit 6ecefd5903

Jakub Konka <kubkon@jakubkonka.com>
2020-11-02 19:06:23
Add std.Target.current.isDarwin() to exclude non-macs in comptime
1 parent f42ebd1
Changed files (1)
src/Compilation.zig
@@ -472,9 +472,12 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation {
             break :blk false;
         };
 
-        const syslibroot = if (build_options.have_llvm and use_lld and options.is_native_os and options.target.isDarwin()) blk: {
-            const syslibroot_path = try std.zig.system.getSDKPath(arena);
-            break :blk syslibroot_path;
+        const syslibroot = if (build_options.have_llvm and comptime std.Target.current.isDarwin()) outer: {
+            const path = if (use_lld and options.is_native_os and options.target.isDarwin()) inner: {
+                const syslibroot_path = try std.zig.system.getSDKPath(arena);
+                break :inner syslibroot_path;
+            } else null;
+            break :outer path;
         } else null;
 
         const link_libc = options.link_libc or target_util.osRequiresLibC(options.target);