summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-03-13 15:00:27 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-03-13 15:00:39 (GMT)
commit200bc3b785ebc53df2107d0c70c2318996b5d417 (patch)
tree294764d828ce719b0bb042244a2d23f98dee7360 /Tests
parent1b5554e863b4f2a14bb327a6ae3a2ec40ae4af41 (diff)
parent2026915f8f08413a04e2612483eec28d844102d7 (diff)
downloadCMake-200bc3b785ebc53df2107d0c70c2318996b5d417.zip
CMake-200bc3b785ebc53df2107d0c70c2318996b5d417.tar.gz
CMake-200bc3b785ebc53df2107d0c70c2318996b5d417.tar.bz2
Merge topic 'swift-implicit-module-include-dir'
2026915f8f Swift: Propagate Swift_MODULE_DIRECTORY as include directory Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4320
Diffstat (limited to 'Tests')
-rw-r--r--Tests/SwiftOnly/CMakeLists.txt24
-rw-r--r--Tests/SwiftOnly/L.swift1
-rw-r--r--Tests/SwiftOnly/M.swift2
-rw-r--r--Tests/SwiftOnly/N.swift2
4 files changed, 29 insertions, 0 deletions
diff --git a/Tests/SwiftOnly/CMakeLists.txt b/Tests/SwiftOnly/CMakeLists.txt
index f4cbac2..e24279b 100644
--- a/Tests/SwiftOnly/CMakeLists.txt
+++ b/Tests/SwiftOnly/CMakeLists.txt
@@ -1,4 +1,16 @@
cmake_minimum_required(VERSION 3.3)
+
+# NOTE: Force the Release mode configuration as there are some issues with the
+# debug information handling on macOS on certain Xcode builds.
+if(NOT CMAKE_CONFIGURATION_TYPES)
+ set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build" FORCE)
+endif()
+
+# NOTE: enable shared libraries by default. Older Xcode releases do not play
+# well with static libraries, and Windows does not currently support static
+# libraries in Swift.
+set(BUILD_SHARED_LIBS YES)
+
project(SwiftOnly Swift)
if(NOT XCODE_VERSION VERSION_LESS 10.2)
@@ -7,7 +19,19 @@ elseif(NOT XCODE_VERSION VERSION_LESS 8.0)
set(CMAKE_Swift_LANGUAGE_VERSION 3.0)
endif()
+set(CMAKE_Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift)
+
add_executable(SwiftOnly main.swift)
+add_library(L L.swift)
+
+add_library(M M.swift)
+target_link_libraries(M PUBLIC
+ L)
+
+add_library(N N.swift)
+target_link_libraries(N PUBLIC
+ M)
+
# Dummy to make sure generation works with such targets.
add_library(SwiftIface INTERFACE)
diff --git a/Tests/SwiftOnly/L.swift b/Tests/SwiftOnly/L.swift
new file mode 100644
index 0000000..79ff87e
--- /dev/null
+++ b/Tests/SwiftOnly/L.swift
@@ -0,0 +1 @@
+public let ThirtyTwo: Int = 32
diff --git a/Tests/SwiftOnly/M.swift b/Tests/SwiftOnly/M.swift
new file mode 100644
index 0000000..dd333fe
--- /dev/null
+++ b/Tests/SwiftOnly/M.swift
@@ -0,0 +1,2 @@
+import L
+public let SixtyFour: Int = ThirtyTwo * 2
diff --git a/Tests/SwiftOnly/N.swift b/Tests/SwiftOnly/N.swift
new file mode 100644
index 0000000..990ddf9
--- /dev/null
+++ b/Tests/SwiftOnly/N.swift
@@ -0,0 +1,2 @@
+import M
+public let OneTwentyEight = SixtyFour * 2