Skip to content

Commit 55170ad

Browse files
committed
Update GNU_Source import for Linux
1 parent 6cb3b36 commit 55170ad

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Sources/FoundationEssentials/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ endif()
2929

3030
add_dependencies(FoundationEssentials FoundationMacros)
3131

32-
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
33-
target_compile_options(FoundationEssentials PRIVATE "-D_GNU_SOURCE")
32+
if(CMAKE_SYSTEM_NAME STREQUAL Linux OR CMAKE_SYSTEM_NAME STREQUAL Android)
33+
target_compile_options(FoundationEssentials PRIVATE
34+
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -Xcc -Xfrontend -D_GNU_SOURCE>")
35+
list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
3436
endif()
3537

3638
target_compile_options(FoundationEssentials PRIVATE

Sources/FoundationMacros/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ FetchContent_MakeAvailable(SwiftSyntax)
4444

4545
# Link against SwiftSyntax
4646
target_compile_options(FoundationMacros PRIVATE -parse-as-library)
47+
target_compile_options(FoundationMacros PRIVATE
48+
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -enable-experimental-feature -Xfrontend AccessLevelOnImport>")
4749
target_link_libraries(FoundationMacros
4850
SwiftSyntax
4951
SwiftSyntaxMacros

0 commit comments

Comments
 (0)