Skip to content

Commit 44f7f25

Browse files
committed
Fix build
1 parent 39704db commit 44f7f25

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

Package.swift

+10
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,13 @@ let package = Package(
7777
dependencies: ["TSCUtility", "TSCTestSupport"]),
7878
]
7979
)
80+
81+
// FIXME: conditionalise these flags since SwiftPM 5.3 and earlier will crash
82+
// for platforms they don't know about.
83+
#if os(Windows)
84+
if let TSCBasic = package.targets.first(where: { $0.name == "TSCBasic" }) {
85+
TSCBasic.cxxSettings = [
86+
.define("_CRT_SECURE_NO_WARNINGS", .when(platforms: [.windows])),
87+
]
88+
}
89+
#endif

Sources/TSCBasic/CMakeLists.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,10 @@ target_compile_options(TSCBasic PUBLIC
5757
# Ignore secure function warnings on Windows.
5858
"$<$<PLATFORM_ID:Windows>:SHELL:-Xcc -D_CRT_SECURE_NO_WARNINGS>")
5959
target_link_libraries(TSCBasic PUBLIC
60-
TSCLibc)
60+
TSCLibc
61+
SwiftSystem)
6162
target_link_libraries(TSCBasic PRIVATE
62-
TSCclibc)
63+
TSCclibc)
6364
if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
6465
if(Foundation_FOUND)
6566
target_link_libraries(TSCBasic PUBLIC

0 commit comments

Comments
 (0)