Skip to content

Commit a45bf60

Browse files
authored
[Linux] Define _GNU_SOURCE when building TSCclibc (#326)
1 parent 0d37c46 commit a45bf60

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

Package.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,4 +122,10 @@ let package = Package(
122122
.linkedLibrary("Pathcch", .when(platforms: [.windows])),
123123
]
124124
}
125+
#elseif os(Linux)
126+
if let TSCclibc = package.targets.first(where: { $0.name == "TSCclibc" }) {
127+
TSCclibc.cSettings = [
128+
.define("_GNU_SOURCE", .when(platforms: [.linux])),
129+
]
130+
}
125131
#endif

Sources/TSCclibc/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ add_library(TSCclibc STATIC
1010
libc.c process.c)
1111
target_include_directories(TSCclibc PUBLIC
1212
include)
13+
target_compile_definitions(TSCclibc PRIVATE
14+
"$<$<PLATFORM_ID:Linux>:_GNU_SOURCE>")
1315

1416
if(NOT BUILD_SHARED_LIBS)
1517
install(TARGETS TSCclibc

0 commit comments

Comments
 (0)