@@ -54,7 +54,10 @@ let package = Package(
5454 /** Shim target to import missing C headers in Darwin and Glibc modulemap. */
5555 name: " TSCclibc " ,
5656 dependencies: [ ] ,
57- exclude: CMakeFiles) ,
57+ exclude: CMakeFiles,
58+ cSettings: [
59+ . define( " _GNU_SOURCE " , . when( platforms: [ . linux] ) ) ,
60+ ] ) ,
5861 . target(
5962 /** Cross-platform access to bare `libc` functionality. */
6063 name: " TSCLibc " ,
@@ -68,7 +71,13 @@ let package = Package(
6871 " TSCclibc " ,
6972 . product( name: " SystemPackage " , package : " swift-system " ) ,
7073 ] ,
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+ ] ) ,
7281 . target(
7382 /** Abstractions for common operations, should migrate to TSCBasic */
7483 name: " TSCUtility " ,
@@ -111,22 +120,3 @@ let package = Package(
111120 . package ( path: " ../swift-system " ) ,
112121 ]
113122 }
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