@@ -552,6 +552,7 @@ fn addCmakeCfgOptionsToExe(
552552 addCMakeLibraryList (exe , cfg .clang_libraries );
553553 addCMakeLibraryList (exe , cfg .lld_libraries );
554554 addCMakeLibraryList (exe , cfg .llvm_libraries );
555+ addCMakeSystemLibraryList (exe , cfg .clang_system_libraries );
555556 addCMakeSystemLibraryList (exe , cfg .llvm_system_libraries );
556557
557558 if (use_zig_libcxx ) {
@@ -627,10 +628,20 @@ fn addStaticLlvmOptionsToExe(exe: *std.build.LibExeObjStep) !void {
627628 }
628629
629630 exe .linkSystemLibrary ("z" );
630- exe .linkSystemLibrary ("zstd" );
631631
632- // This means we rely on clang-or-zig-built LLVM, Clang, LLD libraries.
633- exe .linkSystemLibrary ("c++" );
632+ if (exe .target .getOs ().tag != .windows and exe .target .getAbi () != .msvc ) {
633+ // TODO: Support this on msvc
634+ exe .linkSystemLibrary ("zstd" );
635+
636+ // This means we rely on clang-or-zig-built LLVM, Clang, LLD libraries.
637+ exe .linkSystemLibrary ("c++" );
638+ }
639+
640+ if (exe .target .getOs ().tag == .windows ) {
641+ exe .linkSystemLibrary ("version" );
642+ exe .linkSystemLibrary ("uuid" );
643+ exe .linkSystemLibrary ("ole32" );
644+ }
634645}
635646
636647fn addCxxKnownPath (
@@ -707,6 +718,7 @@ const CMakeConfig = struct {
707718 lld_include_dir : []const u8 ,
708719 lld_libraries : []const u8 ,
709720 clang_libraries : []const u8 ,
721+ clang_system_libraries : []const u8 ,
710722 llvm_lib_dir : []const u8 ,
711723 llvm_include_dir : []const u8 ,
712724 llvm_libraries : []const u8 ,
@@ -773,6 +785,7 @@ fn parseConfigH(b: *Builder, config_h_text: []const u8) ?CMakeConfig {
773785 .lld_include_dir = undefined ,
774786 .lld_libraries = undefined ,
775787 .clang_libraries = undefined ,
788+ .clang_system_libraries = undefined ,
776789 .llvm_lib_dir = undefined ,
777790 .llvm_include_dir = undefined ,
778791 .llvm_libraries = undefined ,
@@ -813,6 +826,10 @@ fn parseConfigH(b: *Builder, config_h_text: []const u8) ?CMakeConfig {
813826 .prefix = "#define ZIG_CLANG_LIBRARIES " ,
814827 .field = "clang_libraries" ,
815828 },
829+ .{
830+ .prefix = "#define ZIG_CLANG_SYSTEM_LIBRARIES " ,
831+ .field = "clang_system_libraries" ,
832+ },
816833 .{
817834 .prefix = "#define ZIG_LLVM_LIBRARIES " ,
818835 .field = "llvm_libraries" ,
0 commit comments