Skip to content

Commit 1334b65

Browse files
committed
Only explicitly declare Foundation library linkage on non-Apple platforms (see comment)
1 parent 6ab5161 commit 1334b65

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

Sources/Overlays/_Testing_Foundation/CMakeLists.txt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,18 @@ add_library(_Testing_Foundation
1717
ReexportTesting.swift)
1818

1919
target_link_libraries(_Testing_Foundation PUBLIC
20-
Testing
21-
Foundation)
20+
Testing)
21+
22+
# Although this library links Foundation on all platforms, it only does so using
23+
# `target_link_libraries()` when building for non-Apple platforms. This is
24+
# because that command uses the `-lFoundation` linker flag, but on Apple
25+
# platforms Foundation is a .framework and requires a different flag. However,
26+
# we don't need to explicitly pass any linker flag since it's handled
27+
# automatically on Apple platforms via auto-linking.
28+
if(NOT APPLE)
29+
target_link_libraries(Testing PUBLIC
30+
Foundation)
31+
endif()
2232

2333
# Note: This does not enable Library Evolution, despite emitting a module
2434
# interface, because Foundation does not have Library Evolution enabled for all

0 commit comments

Comments
 (0)