summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/Swift
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/RunCMake/Swift')
-rw-r--r--Tests/RunCMake/Swift/CMP0157-NEW-stderr.txt3
-rw-r--r--Tests/RunCMake/Swift/CMP0157-NEW.cmake4
-rw-r--r--Tests/RunCMake/Swift/CMP0157-OLD-build-stdout.txt1
-rw-r--r--Tests/RunCMake/Swift/CMP0157-OLD.cmake4
-rw-r--r--Tests/RunCMake/Swift/CMP0157-WARN.cmake3
-rw-r--r--Tests/RunCMake/Swift/CMP0157-common.cmake19
-rw-r--r--Tests/RunCMake/Swift/IncrementalSwift-second-stdout.txt6
-rw-r--r--Tests/RunCMake/Swift/IncrementalSwift.cmake1
-rw-r--r--Tests/RunCMake/Swift/NoWorkToDo.cmake1
-rw-r--r--Tests/RunCMake/Swift/RunCMakeTest.cmake26
-rw-r--r--Tests/RunCMake/Swift/Win32ExecutableIgnored.cmake1
11 files changed, 63 insertions, 6 deletions
diff --git a/Tests/RunCMake/Swift/CMP0157-NEW-stderr.txt b/Tests/RunCMake/Swift/CMP0157-NEW-stderr.txt
new file mode 100644
index 0000000..82adcda
--- /dev/null
+++ b/Tests/RunCMake/Swift/CMP0157-NEW-stderr.txt
@@ -0,0 +1,3 @@
+CMake Warning \(dev\) in CMakeLists.txt:
+ Unknown Swift_COMPILATION_MODE on target 'greetings_who_knows'
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/Swift/CMP0157-NEW.cmake b/Tests/RunCMake/Swift/CMP0157-NEW.cmake
new file mode 100644
index 0000000..96c2ff4
--- /dev/null
+++ b/Tests/RunCMake/Swift/CMP0157-NEW.cmake
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 3.28)
+
+cmake_policy(SET CMP0157 NEW)
+include(CMP0157-common.cmake)
diff --git a/Tests/RunCMake/Swift/CMP0157-OLD-build-stdout.txt b/Tests/RunCMake/Swift/CMP0157-OLD-build-stdout.txt
new file mode 100644
index 0000000..0955c61
--- /dev/null
+++ b/Tests/RunCMake/Swift/CMP0157-OLD-build-stdout.txt
@@ -0,0 +1 @@
+swiftc .* -output-file-map CMakeFiles/greetings_default.dir//output-file-map.json .*
diff --git a/Tests/RunCMake/Swift/CMP0157-OLD.cmake b/Tests/RunCMake/Swift/CMP0157-OLD.cmake
new file mode 100644
index 0000000..6b0ec94
--- /dev/null
+++ b/Tests/RunCMake/Swift/CMP0157-OLD.cmake
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 3.28)
+
+cmake_policy(SET CMP0157 OLD)
+include(CMP0157-common.cmake)
diff --git a/Tests/RunCMake/Swift/CMP0157-WARN.cmake b/Tests/RunCMake/Swift/CMP0157-WARN.cmake
new file mode 100644
index 0000000..7d8c01d
--- /dev/null
+++ b/Tests/RunCMake/Swift/CMP0157-WARN.cmake
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.28)
+
+include(CMP0157-common.cmake)
diff --git a/Tests/RunCMake/Swift/CMP0157-common.cmake b/Tests/RunCMake/Swift/CMP0157-common.cmake
new file mode 100644
index 0000000..53f14f6
--- /dev/null
+++ b/Tests/RunCMake/Swift/CMP0157-common.cmake
@@ -0,0 +1,19 @@
+enable_language(Swift)
+
+add_executable(greetings_default hello.swift)
+
+add_executable(greetings_wmo hello.swift)
+set_target_properties(greetings_wmo PROPERTIES
+ Swift_COMPILATION_MODE "wholemodule")
+
+add_executable(greetings_incremental hello.swift)
+set_target_properties(greetings_incremental PROPERTIES
+ Swift_COMPILATION_MODE "incremental")
+
+add_executable(greetings_singlefile hello.swift)
+set_target_properties(greetings_singlefile PROPERTIES
+ Swift_COMPILATION_MODE "singlefile")
+
+add_executable(greetings_who_knows hello.swift)
+set_target_properties(greetings_who_knows PROPERTIES
+ Swift_COMPILATION_MODE "not-a-real-mode")
diff --git a/Tests/RunCMake/Swift/IncrementalSwift-second-stdout.txt b/Tests/RunCMake/Swift/IncrementalSwift-second-stdout.txt
index bb08a49..d644d6b 100644
--- a/Tests/RunCMake/Swift/IncrementalSwift-second-stdout.txt
+++ b/Tests/RunCMake/Swift/IncrementalSwift-second-stdout.txt
@@ -1,3 +1,3 @@
-.*Linking Swift static library libA.a
-.*Linking Swift static library libB.a
-FAILED: libB.a CMakeFiles/B.dir/b.swift.o B.swiftmodule
+.*Building Swift object A.swiftmodule CMakeFiles/A.dir/a.swift.o
+.*Building Swift object B.swiftmodule CMakeFiles/B.dir/b.swift.o
+FAILED: B.swiftmodule CMakeFiles/B.dir/b.swift.o
diff --git a/Tests/RunCMake/Swift/IncrementalSwift.cmake b/Tests/RunCMake/Swift/IncrementalSwift.cmake
index 092269f..08f3fff 100644
--- a/Tests/RunCMake/Swift/IncrementalSwift.cmake
+++ b/Tests/RunCMake/Swift/IncrementalSwift.cmake
@@ -1,3 +1,4 @@
+cmake_policy(SET CMP0157 NEW)
enable_language(Swift)
# Write initial files to build directory
diff --git a/Tests/RunCMake/Swift/NoWorkToDo.cmake b/Tests/RunCMake/Swift/NoWorkToDo.cmake
index 51c2ff3..02b9195 100644
--- a/Tests/RunCMake/Swift/NoWorkToDo.cmake
+++ b/Tests/RunCMake/Swift/NoWorkToDo.cmake
@@ -1,3 +1,4 @@
+cmake_policy(SET CMP0157 NEW)
enable_language(Swift)
add_executable(hello1 hello.swift)
set_target_properties(hello1 PROPERTIES ENABLE_EXPORTS TRUE)
diff --git a/Tests/RunCMake/Swift/RunCMakeTest.cmake b/Tests/RunCMake/Swift/RunCMakeTest.cmake
index 5537c01..184b461 100644
--- a/Tests/RunCMake/Swift/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Swift/RunCMakeTest.cmake
@@ -1,11 +1,15 @@
include(RunCMake)
if(RunCMake_GENERATOR STREQUAL Xcode)
- if(XCODE_BELOW_6_1)
+ if(XCODE_VERSION VERSION_LESS 6.1)
run_cmake(XcodeTooOld)
+ elseif(CMake_TEST_Swift)
+ run_cmake(CMP0157-NEW)
+ run_cmake(CMP0157-OLD)
+ run_cmake(CMP0157-WARN)
endif()
elseif(RunCMake_GENERATOR STREQUAL Ninja)
- if(CMAKE_Swift_COMPILER)
+ if(CMake_TEST_Swift)
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
run_cmake_with_options(Win32ExecutableDisallowed)
else()
@@ -45,11 +49,27 @@ elseif(RunCMake_GENERATOR STREQUAL Ninja)
run_cmake_command(IncrementalSwift-second ${CMAKE_COMMAND} --build ${IncrementalSwift_TEST_BINARY_DIR} -- -d explain)
endblock()
+ block()
+ set(CMP0157-OLD_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CMP0157-OLD-build)
+ set(CMP0157-OLD_TEST_NO_CLEAN 1)
+ set(CMP0157-OLD_TEST_OUTPUT_MERGE 1)
+
+ run_cmake(CMP0157-NEW)
+ run_cmake(CMP0157-OLD)
+ # -n: dry-run to avoid actually compiling, -v: verbose to capture executed command
+ run_cmake_command(CMP0157-OLD-build ${CMAKE_COMMAND} --build ${CMP0157-OLD_TEST_BINARY_DIR} -- -n -v)
+ run_cmake(CMP0157-WARN)
+ endblock()
+
endif()
elseif(RunCMake_GENERATOR STREQUAL "Ninja Multi-Config")
- if(CMAKE_Swift_COMPILER)
+ if(CMake_TEST_Swift)
set(RunCMake_TEST_OPTIONS "-DCMAKE_CONFIGURATION_TYPES=Debug\\;Release")
run_cmake(SwiftSimple)
+
+ run_cmake(CMP0157-NEW)
+ run_cmake(CMP0157-OLD)
+ run_cmake(CMP0157-WARN)
unset(RunCMake_TEST_OPTIONS)
endif()
else()
diff --git a/Tests/RunCMake/Swift/Win32ExecutableIgnored.cmake b/Tests/RunCMake/Swift/Win32ExecutableIgnored.cmake
index 02d5447..5e52911 100644
--- a/Tests/RunCMake/Swift/Win32ExecutableIgnored.cmake
+++ b/Tests/RunCMake/Swift/Win32ExecutableIgnored.cmake
@@ -1,3 +1,4 @@
+cmake_policy(SET CMP0157 NEW)
enable_language(Swift)
add_executable(E E.swift)
set_target_properties(E PROPERTIES