summaryrefslogtreecommitdiffstats
path: root/Modules/Platform
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/Platform')
-rw-r--r--Modules/Platform/Apple-Apple-Swift.cmake13
-rw-r--r--Modules/Platform/Linux-Apple-Swift.cmake5
-rw-r--r--Modules/Platform/Windows-Apple-Swift.cmake5
3 files changed, 23 insertions, 0 deletions
diff --git a/Modules/Platform/Apple-Apple-Swift.cmake b/Modules/Platform/Apple-Apple-Swift.cmake
index 7ca3e36..237f6e4 100644
--- a/Modules/Platform/Apple-Apple-Swift.cmake
+++ b/Modules/Platform/Apple-Apple-Swift.cmake
@@ -1 +1,14 @@
set(CMAKE_Swift_SYSROOT_FLAG "-sdk")
+
+# Linker Selections
+if("${CMAKE_GENERATOR}" STREQUAL Xcode)
+ # Xcode always uses clang to link, regardless of what the cmake link language
+ # is. Pass the clang flags when linking with Xcode.
+ set(CMAKE_Swift_USING_LINKER_APPLE_CLASSIC "-fuse-ld=ld" "LINKER:-ld_classic")
+ set(CMAKE_Swift_USING_LINKER_LLD "-fuse-ld=lld")
+ set(CMAKE_Swift_USING_LINKER_SYSTEM "-fuse-ld=ld")
+else()
+ set(CMAKE_Swift_USING_LINKER_APPLE_CLASSIC "-use-ld=ld" "LINKER:-ld_classic")
+ set(CMAKE_Swift_USING_LINKER_LLD "-use-ld=lld")
+ set(CMAKE_Swift_USING_LINKER_SYSTEM "-use-ld=ld")
+endif()
diff --git a/Modules/Platform/Linux-Apple-Swift.cmake b/Modules/Platform/Linux-Apple-Swift.cmake
new file mode 100644
index 0000000..22f0554
--- /dev/null
+++ b/Modules/Platform/Linux-Apple-Swift.cmake
@@ -0,0 +1,5 @@
+# Linker Selection
+# BFD is known to mislink Swift objects resulting in missing type info
+set(CMAKE_Swift_USING_LINKER_SYSTEM "")
+set(CMAKE_Swift_USING_LINKER_GOLD "-use-ld=gold")
+set(CMAKE_Swift_USING_LINKER_LLD "-use-ld=lld")
diff --git a/Modules/Platform/Windows-Apple-Swift.cmake b/Modules/Platform/Windows-Apple-Swift.cmake
index 3f754fd..87c81d6 100644
--- a/Modules/Platform/Windows-Apple-Swift.cmake
+++ b/Modules/Platform/Windows-Apple-Swift.cmake
@@ -1,3 +1,8 @@
set(CMAKE_Swift_IMPLIB_LINKER_FLAGS "-Xlinker -implib:<TARGET_IMPLIB>")
set(CMAKE_Swift_FLAGS_DEBUG_LINKER_FLAGS "-Xlinker -debug")
set(CMAKE_Swift_FLAGS_RELWITHDEBINFO_LINKER_FLAGS "-Xlinker -debug")
+
+# Linker Selection
+set(CMAKE_Swift_USING_LINKER_SYSTEM "-use-ld=link")
+set(CMAKE_Swift_USING_LINKER_LLD "-use-ld=lld")
+set(CMAKE_Swift_USING_LINKER_MSVC "-use-ld=link")