summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/Swift/SwiftLibraryModuleCommand.cmake
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2024-01-08 21:02:21 (GMT)
committerSaleem Abdulrasool <compnerd@compnerd.org>2024-01-09 17:13:34 (GMT)
commit9e829779f249402071ee979705728db3066000fa (patch)
treeea3d9e762437041e84d32814492578f565ce5aba /Tests/RunCMake/Swift/SwiftLibraryModuleCommand.cmake
parent38234058ff68d3e28b8c4672033dd118127581be (diff)
downloadCMake-9e829779f249402071ee979705728db3066000fa.zip
CMake-9e829779f249402071ee979705728db3066000fa.tar.gz
CMake-9e829779f249402071ee979705728db3066000fa.tar.bz2
Swift: preserve `-static` for static library swiftmodules
The `-static` is important for the emission of the module as it is serialized into the swiftmodule which then is used by the Swift frontend to decide how to link to the symbol (via the GOT or not, or the IAT on Windows). This repairs building static libraries with Swift on Windows.
Diffstat (limited to 'Tests/RunCMake/Swift/SwiftLibraryModuleCommand.cmake')
-rw-r--r--Tests/RunCMake/Swift/SwiftLibraryModuleCommand.cmake8
1 files changed, 8 insertions, 0 deletions
diff --git a/Tests/RunCMake/Swift/SwiftLibraryModuleCommand.cmake b/Tests/RunCMake/Swift/SwiftLibraryModuleCommand.cmake
new file mode 100644
index 0000000..7127751
--- /dev/null
+++ b/Tests/RunCMake/Swift/SwiftLibraryModuleCommand.cmake
@@ -0,0 +1,8 @@
+if(POLICY CMP0157)
+ cmake_policy(SET CMP0157 NEW)
+endif()
+
+enable_language(Swift)
+
+add_library(StaticLibrary STATIC L.swift)
+add_library(DynamicLibrary SHARED L.swift)