         .target(
             name: "libllbuild",
             dependencies: ["llbuildCore", "llbuildBuildSystem"],
-            path: "products/libllbuild"
+            path: "products/libllbuild",
+            cxxSettings: [
+              .define("LLVM_ON_WIN32", .when(platforms: [.windows])),
+            ]
         ),
 
         /// The public llbuild Swift API.

        // MARK: Ingested LLVM code.
        .target(
          name: "llvmDemangle",
          path: "lib/llvm/Demangle"
        ),

        .target(
            name: "llvmSupport",
            dependencies: ["llvmDemangle"],
            path: "lib/llvm/Support",
            linkerSettings: [
                .linkedLibrary("m", .when(platforms: [.linux])),
                .linkedLibrary("ncurses", .when(platforms: [.linux, .macOS]))]

        .target(
            name: "llbuildBasic",
            dependencies: ["llvmSupport"],
            path: "lib/Basic",
            cxxSettings: [
              .define("LLVM_ON_WIN32", .when(platforms: [.windows])),
            ]
        ),
        .target(
            name: "llbuildCore",
