         .target(
             name: "llbuildBuildSystem",
             dependencies: ["llbuildCore"],
-            path: "lib/BuildSystem",
-            cxxSettings: [
-              .define("LLVM_ON_WIN32", .when(platforms: [.windows])),
-            ]
+            path: "lib/BuildSystem"
         ),
         .target(
             name: "llbuildEvo",

        .target(
            name: "libllbuild",
            dependencies: ["llbuildCore", "llbuildBuildSystem"],
            path: "products/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])),
            ]
        ),

        /// The public llbuild Swift API.

    ],
    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
