diff options
author | Evan Wilde <etceterawilde@gmail.com> | 2024-03-24 02:02:55 (GMT) |
---|---|---|
committer | Evan Wilde <etceterawilde@gmail.com> | 2024-04-15 15:23:39 (GMT) |
commit | 56e5cea6008397f83479952d4c59964c32bc35fd (patch) | |
tree | b7fc9b925f9a9967c55f8189d964149bfcfbde69 /Tests/SwiftOnly/CMakeLists.txt | |
parent | 6e545349143ee7ce14cfa213e5ae41586836b2c6 (diff) | |
download | CMake-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 'Tests/SwiftOnly/CMakeLists.txt')
-rw-r--r-- | Tests/SwiftOnly/CMakeLists.txt | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/Tests/SwiftOnly/CMakeLists.txt b/Tests/SwiftOnly/CMakeLists.txt index 3d2fe73..4754711 100644 --- a/Tests/SwiftOnly/CMakeLists.txt +++ b/Tests/SwiftOnly/CMakeLists.txt @@ -54,16 +54,7 @@ endif() add_library(SwiftIface INTERFACE) target_link_libraries(SwiftOnly PRIVATE SwiftIface) -# @_alwaysEmitIntoClient ensures that the function body is inserted into the -# swiftmodule instead of as a symbol in the binary itself. I'm doing this to -# avoid having to link the executable. There are some flags required in order to -# link an executable into a library that I didn't see CMake emitting for Swift -# on macOS. AEIC is the easiest workaround that still tests this functionality. -# Unfortunately, AEIC was only added recently (~Swift 5.2), so we need to check -# that it is available before using it. -if(CMAKE_Swift_COMPILER_VERSION VERSION_GREATER_EQUAL 5.2) - add_subdirectory("SwiftPlugin") -endif() +add_subdirectory("SwiftPlugin") function(test_cmp0157_default mode) if(POLICY CMP0157) |