Browse Source

Tests: Fix SwiftMix tests' runtime library selection on Windows

Swift on Windows provides only a release runtime.
Use it for C and CXX too, in all configurations, to match.

Issue: #25573
Suggested-by: Saleem Abdulrasool <[email protected]>
Brad King 1 year ago
parent
commit
b2129a14f4
2 changed files with 7 additions and 1 deletions
  1. 4 1
      Tests/SwiftMix/CMakeLists.txt
  2. 3 0
      Tests/SwiftMixLib/CMakeLists.txt

+ 4 - 1
Tests/SwiftMix/CMakeLists.txt

@@ -1,6 +1,9 @@
-cmake_minimum_required(VERSION 3.3)
+cmake_minimum_required(VERSION 3.15)
 project(SwiftMix C Swift)
 
+# Swift on Windows only provides a release runtime.
+set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreadedDLL)
+
 add_executable(SwiftMix CMain.c ObjCMain.m SwiftMain.swift ObjC-Swift.h)
 set_property(TARGET SwiftMix PROPERTY XCODE_ATTRIBUTE_SWIFT_OBJC_BRIDGING_HEADER "ObjC-Swift.h")
 target_compile_options(SwiftMix PRIVATE "$<$<COMPILE_LANGUAGE:C>:-Werror=objc-method-access>")

+ 3 - 0
Tests/SwiftMixLib/CMakeLists.txt

@@ -1,6 +1,9 @@
 cmake_minimum_required(VERSION 3.24)
 project(SwiftMixLib C CXX Swift)
 
+# Swift on Windows only provides a release runtime.
+set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreadedDLL)
+
 add_library(SwiftMixedLib lib.c lib.cpp lib.swift)
 add_executable(Swifty main.swift)
 target_link_libraries(Swifty PUBLIC SwiftMixedLib)