@@ -54,7 +54,10 @@ let package = Package(
54
54
/** Shim target to import missing C headers in Darwin and Glibc modulemap. */
55
55
name: " TSCclibc " ,
56
56
dependencies: [ ] ,
57
- exclude: CMakeFiles) ,
57
+ exclude: CMakeFiles,
58
+ cSettings: [
59
+ . define( " _GNU_SOURCE " , . when( platforms: [ . linux] ) ) ,
60
+ ] ) ,
58
61
. target(
59
62
/** Cross-platform access to bare `libc` functionality. */
60
63
name: " TSCLibc " ,
@@ -68,7 +71,13 @@ let package = Package(
68
71
" TSCclibc " ,
69
72
. product( name: " SystemPackage " , package : " swift-system " ) ,
70
73
] ,
71
- exclude: CMakeFiles + [ " README.md " ] ) ,
74
+ exclude: CMakeFiles + [ " README.md " ] ,
75
+ cxxSettings: [
76
+ . define( " _CRT_SECURE_NO_WARNINGS " , . when( platforms: [ . windows] ) ) ,
77
+ ] ,
78
+ linkerSettings: [
79
+ . linkedLibrary( " Pathcch " , . when( platforms: [ . windows] ) ) ,
80
+ ] ) ,
72
81
. target(
73
82
/** Abstractions for common operations, should migrate to TSCBasic */
74
83
name: " TSCUtility " ,
@@ -111,22 +120,3 @@ let package = Package(
111
120
. package ( path: " ../swift-system " ) ,
112
121
]
113
122
}
114
-
115
- // FIXME: conditionalise these flags since SwiftPM 5.3 and earlier will crash
116
- // for platforms they don't know about.
117
- #if os(Windows)
118
- if let TSCBasic = package . targets. first ( where: { $0. name == " TSCBasic " } ) {
119
- TSCBasic . cxxSettings = [
120
- . define( " _CRT_SECURE_NO_WARNINGS " , . when( platforms: [ . windows] ) ) ,
121
- ]
122
- TSCBasic . linkerSettings = [
123
- . linkedLibrary( " Pathcch " , . when( platforms: [ . windows] ) ) ,
124
- ]
125
- }
126
- #elseif os(Linux)
127
- if let TSCclibc = package . targets. first ( where: { $0. name == " TSCclibc " } ) {
128
- TSCclibc . cSettings = [
129
- . define( " _GNU_SOURCE " , . when( platforms: [ . linux] ) ) ,
130
- ]
131
- }
132
- #endif
0 commit comments