Skip to content

Commit fa171fd

Browse files
committed
build: synchronise CMake and Package.swift for Windows
Add the additional link dependency on Windows and a macro definition to avoid some spew from the library build. Note that this is using an OS specific block to alter the settings rather than the inline definition since older versions of s-p-m may crash on the application of the setting. This requires bumping the tools version to 5.2.
1 parent 2ecf988 commit fa171fd

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

Package.swift

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.1
1+
// swift-tools-version:5.2
22

33
/*
44
This source file is part of the Swift.org open source project
@@ -83,3 +83,16 @@ let package = Package(
8383
dependencies: ["TSCUtility", "TSCTestSupport", "TSCTestSupportExecutable"]),
8484
]
8585
)
86+
87+
// FIXME: conditionalise these flags since SwiftPM 5.3 and earlier will crash
88+
// for platforms they don't know about.
89+
#if os(Windows)
90+
if let TSCBasic = package.targets.first(where: { $0.name == "TSCBasic" }) {
91+
TSCBasic.cxxSettings = [
92+
.define("_CRT_SECURE_NO_WARNINGS", .when(platforms: [.windows])),
93+
]
94+
TSCBasic.linkerSettings = [
95+
.linkedLibrary("Pathcch", .when(platforms: [.windows])),
96+
]
97+
}
98+
#endif

0 commit comments

Comments
 (0)