@@ -206,10 +206,14 @@ public final class UserToolchain: Toolchain {
206
206
}
207
207
208
208
public static func deriveSwiftCFlags( triple: Triple , destination: Destination ) -> [ String ] {
209
- return ( triple. isDarwin ( ) || triple. isAndroid ( ) || triple. isWASI ( )
210
- ? [ " -sdk " , destination. sdk. pathString]
211
- : [ ] )
212
- + destination. extraSwiftCFlags
209
+ guard let sdk = destination. sdk else {
210
+ return destination. extraSwiftCFlags
211
+ }
212
+
213
+ return ( triple. isDarwin ( ) || triple. isAndroid ( ) || triple. isWASI ( )
214
+ ? [ " -sdk " , sdk. pathString]
215
+ : [ ] )
216
+ + destination. extraSwiftCFlags
213
217
}
214
218
215
219
public init ( destination: Destination , environment: [ String : String ] = ProcessEnv . vars) throws {
@@ -252,9 +256,13 @@ public final class UserToolchain: Toolchain {
252
256
253
257
self . extraSwiftCFlags = UserToolchain . deriveSwiftCFlags ( triple: triple, destination: destination)
254
258
255
- self . extraCCFlags = [
256
- triple. isDarwin ( ) ? " -isysroot " : " --sysroot " , destination. sdk. pathString
257
- ] + destination. extraCCFlags
259
+ if let sdk = destination. sdk {
260
+ self . extraCCFlags = [
261
+ triple. isDarwin ( ) ? " -isysroot " : " --sysroot " , sdk. pathString
262
+ ] + destination. extraCCFlags
263
+ } else {
264
+ self . extraCCFlags = destination. extraCCFlags
265
+ }
258
266
259
267
// Compute the path of directory containing the PackageDescription libraries.
260
268
var pdLibDir = UserManifestResources . libDir ( forBinDir: binDir)
0 commit comments