summaryrefslogtreecommitdiffstats
path: root/Tests/SwiftOnly
diff options
context:
space:
mode:
authorDave Abrahams <dabrahams@adobe.com>2024-05-23 00:55:30 (GMT)
committerDave Abrahams <dabrahams@adobe.com>2024-05-24 22:23:41 (GMT)
commit5bb7f8a4dd4671f9343461e5377759b8a4947a4e (patch)
tree92fc45ac7b467907a0845db25fa4635681b8385c /Tests/SwiftOnly
parentb2e042d77a0bfe21712a2f802668d04df2518bdc (diff)
downloadCMake-5bb7f8a4dd4671f9343461e5377759b8a4947a4e.zip
CMake-5bb7f8a4dd4671f9343461e5377759b8a4947a4e.tar.gz
CMake-5bb7f8a4dd4671f9343461e5377759b8a4947a4e.tar.bz2
Swift: Use per-config module file locations in multi-config generators
Place `.swiftmodule` files a subdirectory named after the configuration. Fixes: #25864 Fixes: #25997 - Swift/RunCMakeTest.cmake: - CMP0157-OLD was enabled for Xcode, where it works. - A test was added that verifies .swiftmodule's are generated into separate directories with multi-config generators. - Tests/SwiftOnly/CMakeLists.txt: tests were added that validate that cross-subdirectory module dependencies (via target_link_libraries) work.
Diffstat (limited to 'Tests/SwiftOnly')
-rw-r--r--Tests/SwiftOnly/CMakeLists.txt4
-rw-r--r--Tests/SwiftOnly/SubC/CMakeLists.txt2
-rw-r--r--Tests/SwiftOnly/SubC/SubC.swift1
-rw-r--r--Tests/SwiftOnly/SubD/CMakeLists.txt1
-rw-r--r--Tests/SwiftOnly/SubD/SubD.swift1
-rw-r--r--Tests/SwiftOnly/SubE/CMakeLists.txt2
-rw-r--r--Tests/SwiftOnly/SubE/main.swift1
7 files changed, 12 insertions, 0 deletions
diff --git a/Tests/SwiftOnly/CMakeLists.txt b/Tests/SwiftOnly/CMakeLists.txt
index 25892f1..e933ea1 100644
--- a/Tests/SwiftOnly/CMakeLists.txt
+++ b/Tests/SwiftOnly/CMakeLists.txt
@@ -28,6 +28,10 @@ endif()
add_subdirectory(SubA)
add_subdirectory(SubB)
+add_subdirectory(SubC)
+add_subdirectory(SubD)
+add_subdirectory(SubE)
+
set(CMAKE_Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift)
add_executable(SwiftOnly main.swift)
diff --git a/Tests/SwiftOnly/SubC/CMakeLists.txt b/Tests/SwiftOnly/SubC/CMakeLists.txt
new file mode 100644
index 0000000..4fdb3d3
--- /dev/null
+++ b/Tests/SwiftOnly/SubC/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_library(SubC SubC.swift)
+target_link_libraries(SubC PUBLIC SubD)
diff --git a/Tests/SwiftOnly/SubC/SubC.swift b/Tests/SwiftOnly/SubC/SubC.swift
new file mode 100644
index 0000000..1ca44f4
--- /dev/null
+++ b/Tests/SwiftOnly/SubC/SubC.swift
@@ -0,0 +1 @@
+import SubD
diff --git a/Tests/SwiftOnly/SubD/CMakeLists.txt b/Tests/SwiftOnly/SubD/CMakeLists.txt
new file mode 100644
index 0000000..01b38d3
--- /dev/null
+++ b/Tests/SwiftOnly/SubD/CMakeLists.txt
@@ -0,0 +1 @@
+add_library(SubD SubD.swift)
diff --git a/Tests/SwiftOnly/SubD/SubD.swift b/Tests/SwiftOnly/SubD/SubD.swift
new file mode 100644
index 0000000..857d3f4
--- /dev/null
+++ b/Tests/SwiftOnly/SubD/SubD.swift
@@ -0,0 +1 @@
+public let x = 42
diff --git a/Tests/SwiftOnly/SubE/CMakeLists.txt b/Tests/SwiftOnly/SubE/CMakeLists.txt
new file mode 100644
index 0000000..099a81c
--- /dev/null
+++ b/Tests/SwiftOnly/SubE/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_executable(SubE main.swift)
+target_link_libraries(SubE PUBLIC SubD)
diff --git a/Tests/SwiftOnly/SubE/main.swift b/Tests/SwiftOnly/SubE/main.swift
new file mode 100644
index 0000000..1ca44f4
--- /dev/null
+++ b/Tests/SwiftOnly/SubE/main.swift
@@ -0,0 +1 @@
+import SubD