     ],
     cxxLanguageStandard: .cxx14
 )
+
+// FIXME: Conditionalize these flags since SwiftPM 5.3 and earlier will crash for platforms they don't know about.
+#if os(Windows)
+
+["llvmSupport", "llvmDemangle", "llbuildBuildSystem", "llbuildBasic"].forEach {
+    package.targets.first{ $0.name == $0 }?.cxxSettings = [
+        .define("LLVM_ON_WIN32", .when(platforms: [.windows])),
+    ]
+}
+
+package.targets.first{ $0.name == "libllbuild" }?.cxxSettings = [
+    .define("LLVM_ON_WIN32", .when(platforms: [.windows])),
+    // FIXME: we need to define `libllbuild_EXPORTS` to ensure that the
+    // symbols are exported from the DLL that is being built here until
+    // static linking is supported on Windows.
+    .define("libllbuild_EXPORTS", .when(platforms: [.windows])),
+]
+
+#endif

        // MARK: Ingested LLVM code.
        .target(
          name: "llvmDemangle",
          path: "lib/llvm/Demangle",
          cxxSettings: [
            .define("LLVM_ON_WIN32", .when(platforms: [.windows])),
          ]
        ),

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

        .target(
            name: "llbuildBasic",
            dependencies: ["llvmSupport"],
            path: "lib/Basic"
        ),
        .target(
            name: "llbuildCore",
