summaryrefslogtreecommitdiffstats
path: root/Tests/SwiftOnly/CMakeLists.txt
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-01-20 14:35:49 (GMT)
committerKitware Robot <kwrobot@kitware.com>2023-01-20 14:36:00 (GMT)
commit1d52007564f114a158e9f1612a39e6b33ca37934 (patch)
tree8c0d131227934d651219b4b869bfb5ee5b8d0840 /Tests/SwiftOnly/CMakeLists.txt
parent8150831dfdc445316256c8acdbcf9fd29bced58d (diff)
parent4165eb3d0b21601977b26e8f8af5193c55169cee (diff)
downloadCMake-1d52007564f114a158e9f1612a39e6b33ca37934.zip
CMake-1d52007564f114a158e9f1612a39e6b33ca37934.tar.gz
CMake-1d52007564f114a158e9f1612a39e6b33ca37934.tar.bz2
Merge topic 'ninja-swift-exported-executables'
4165eb3d0b Ninja: Emit swiftmodule from executable with exports Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !8048
Diffstat (limited to 'Tests/SwiftOnly/CMakeLists.txt')
-rw-r--r--Tests/SwiftOnly/CMakeLists.txt11
1 files changed, 11 insertions, 0 deletions
diff --git a/Tests/SwiftOnly/CMakeLists.txt b/Tests/SwiftOnly/CMakeLists.txt
index fa8687d..13cf2b1 100644
--- a/Tests/SwiftOnly/CMakeLists.txt
+++ b/Tests/SwiftOnly/CMakeLists.txt
@@ -43,3 +43,14 @@ target_link_libraries(N PUBLIC
# Dummy to make sure generation works with such targets.
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()