Skip to content

Commit 42fc98e

Browse files
committed
UserToolchain: disable use of -sdk on !Darwin
The non-Darwin targets do not properly support `-sdk`. Passing this in during a build prevents the use of `-sdk` for Swift code with the Swift toolchain and a standalone Swift SDK for a host. This will allow us to begin wiring up `-sdk` for such a usage.
1 parent 8032dc7 commit 42fc98e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Sources/Workspace/UserToolchain.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,10 @@ public final class UserToolchain: Toolchain {
205205
self.xctest = nil
206206
#endif
207207

208-
self.extraSwiftCFlags = [
209-
"-sdk", destination.sdk.pathString
210-
] + destination.extraSwiftCFlags
208+
self.extraSwiftCFlags = (destination.target.isDarwin()
209+
? ["-sdk", destination.sdk.pathString]
210+
: [])
211+
+ destination.extraSwiftCFlags
211212

212213
self.extraCCFlags = [
213214
destination.target.isDarwin() ? "-isysroot" : "--sysroot", destination.sdk.pathString

0 commit comments

Comments
 (0)