summaryrefslogtreecommitdiffstats
path: root/Modules/Platform/Linux-Apple-Swift.cmake
diff options
context:
space:
mode:
authorEvan Wilde <etceterawilde@gmail.com>2024-03-24 02:02:55 (GMT)
committerEvan Wilde <etceterawilde@gmail.com>2024-04-15 15:23:39 (GMT)
commit56e5cea6008397f83479952d4c59964c32bc35fd (patch)
treeb7fc9b925f9a9967c55f8189d964149bfcfbde69 /Modules/Platform/Linux-Apple-Swift.cmake
parent6e545349143ee7ce14cfa213e5ae41586836b2c6 (diff)
downloadCMake-56e5cea6008397f83479952d4c59964c32bc35fd.zip
CMake-56e5cea6008397f83479952d4c59964c32bc35fd.tar.gz
CMake-56e5cea6008397f83479952d4c59964c32bc35fd.tar.bz2
Swift: Support module libraries with command-line build systems
Wire up the flags needed to support module libraries built and used with Swift. We need to pass `-bundle` to the linker when linking module libraries on Darwin, and we need to pass `-export-dynamic` to the linker when emitting an executable that exports symbols on Linux. This patch wires up `CMAKE_SHARED_MODULE_CREATE_Swift_FLAGS` and `CMAKE_SHARED_MODULE_LOADER_Swift_FLAG` on Darwin, and hooks up `CMAKE_EXE_EXPORTS_Swift_FLAG` on Linux in order to support passing things correctly. We can't expose `CMAKE_EXE_LINKER_FLAGS` to Swift, as it contains flags that the Swift compiler doesn't recognize, but the other language-specific variables are safe to expose.
Diffstat (limited to 'Modules/Platform/Linux-Apple-Swift.cmake')
-rw-r--r--Modules/Platform/Linux-Apple-Swift.cmake2
1 files changed, 2 insertions, 0 deletions
diff --git a/Modules/Platform/Linux-Apple-Swift.cmake b/Modules/Platform/Linux-Apple-Swift.cmake
index 22f0554..248d2de 100644
--- a/Modules/Platform/Linux-Apple-Swift.cmake
+++ b/Modules/Platform/Linux-Apple-Swift.cmake
@@ -1,3 +1,5 @@
+set(CMAKE_EXE_EXPORTS_Swift_FLAG "-Xclang-linker -Wl,--export-dynamic")
+
# Linker Selection
# BFD is known to mislink Swift objects resulting in missing type info
set(CMAKE_Swift_USING_LINKER_SYSTEM "")