summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake
diff options
context:
space:
mode:
authorhotwatermorning <hotwatermorning@gmail.com>2021-10-23 18:54:20 (GMT)
committerBrad King <brad.king@kitware.com>2021-10-28 19:32:44 (GMT)
commitc782f140d4dbbffec03d834e0f1b3cf5a7acb004 (patch)
tree2cba37c3f967eb7b82fda249562f79c17ae33bf7 /Tests/RunCMake
parent46bd57d2450e450da4f46f5cb45cb8d1dc617d96 (diff)
downloadCMake-c782f140d4dbbffec03d834e0f1b3cf5a7acb004.zip
CMake-c782f140d4dbbffec03d834e0f1b3cf5a7acb004.tar.gz
CMake-c782f140d4dbbffec03d834e0f1b3cf5a7acb004.tar.bz2
Swift: Ignore WIN32_EXECUTABLE property outside of Windows
Issue: #19877
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r--Tests/RunCMake/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/Swift/RunCMakeTest.cmake13
-rw-r--r--Tests/RunCMake/Swift/Win32ExecutableIgnored.cmake4
3 files changed, 13 insertions, 6 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 0c1258e..5dc7031 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -345,7 +345,7 @@ if(UNIX AND CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG AND CMAKE_EXECUTABLE_FORMAT STRE
add_RunCMake_test(RuntimePath)
endif()
add_RunCMake_test(ScriptMode)
-add_RunCMake_test(Swift -DCMAKE_Swift_COMPILER=${CMAKE_Swift_COMPILER})
+add_RunCMake_test(Swift -DCMAKE_Swift_COMPILER=${CMAKE_Swift_COMPILER} -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME})
add_RunCMake_test(TargetObjects)
add_RunCMake_test(TargetProperties)
add_RunCMake_test(ToolchainFile)
diff --git a/Tests/RunCMake/Swift/RunCMakeTest.cmake b/Tests/RunCMake/Swift/RunCMakeTest.cmake
index 1db202e..21d5a25 100644
--- a/Tests/RunCMake/Swift/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Swift/RunCMakeTest.cmake
@@ -6,11 +6,14 @@ if(RunCMake_GENERATOR STREQUAL Xcode)
endif()
elseif(RunCMake_GENERATOR STREQUAL Ninja)
if(CMAKE_Swift_COMPILER)
- run_cmake(Win32ExecutableDisallowed)
-
- set(RunCMake_TEST_OPTIONS -DCMAKE_SYSTEM_NAME=Darwin)
- run_cmake(SwiftMultiArch)
- unset(RunCMake_TEST_OPTIONS)
+ if (CMAKE_SYSTEM_NAME MATCHES "Windows")
+ run_cmake_with_options(Win32ExecutableDisallowed)
+ else()
+ run_cmake_with_options(Win32ExecutableIgnored)
+ set(RunCMake_TEST_OPTIONS -DCMAKE_SYSTEM_NAME=Darwin)
+ run_cmake(SwiftMultiArch)
+ unset(RunCMake_TEST_OPTIONS)
+ endif()
endif()
elseif(RunCMake_GENERATOR STREQUAL "Ninja Multi-Config")
if(CMAKE_Swift_COMPILER)
diff --git a/Tests/RunCMake/Swift/Win32ExecutableIgnored.cmake b/Tests/RunCMake/Swift/Win32ExecutableIgnored.cmake
new file mode 100644
index 0000000..02d5447
--- /dev/null
+++ b/Tests/RunCMake/Swift/Win32ExecutableIgnored.cmake
@@ -0,0 +1,4 @@
+enable_language(Swift)
+add_executable(E E.swift)
+set_target_properties(E PROPERTIES
+ WIN32_EXECUTABLE TRUE)