summaryrefslogtreecommitdiff
path: root/Modules/CMakeSwiftInformation.cmake
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2019-05-21 08:36:54 -0700
committerSaleem Abdulrasool <compnerd@compnerd.org>2019-05-21 08:38:23 -0700
commit24223ac84bd1610cef2ab0935233387227653dfd (patch)
tree0329271e712c84c2f65bd749291634f62d649967 /Modules/CMakeSwiftInformation.cmake
parent7e636fd8e0f10c8e0ba5eea529f4fedffd899ecf (diff)
downloadcmake-24223ac84bd1610cef2ab0935233387227653dfd.tar.gz
Modules: add Swift MSVC_RUNTIME_LIBRARY flags
This adds support for the newly minted `-libc` flag to the Swift driver invocation. These allow users to control the MSVC linkage properly on Windows targets.
Diffstat (limited to 'Modules/CMakeSwiftInformation.cmake')
-rw-r--r--Modules/CMakeSwiftInformation.cmake8
1 files changed, 8 insertions, 0 deletions
diff --git a/Modules/CMakeSwiftInformation.cmake b/Modules/CMakeSwiftInformation.cmake
index 15b0a1a87a..8ec48911a6 100644
--- a/Modules/CMakeSwiftInformation.cmake
+++ b/Modules/CMakeSwiftInformation.cmake
@@ -23,6 +23,14 @@ set(CMAKE_Swift_COMPILE_OPTIONS_TARGET "-target ")
set(CMAKE_Swift_COMPILER_ARG1 -frontend)
set(CMAKE_Swift_FRAMEWORK_SEARCH_FLAG "-F ")
+# NOTE(compnerd) use the short form for convenience and ease of search. They
+# are treated equivalent to their long form names as well as custom Swift
+# specific names.
+set(CMAKE_Swift_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreaded -libc MT)
+set(CMAKE_Swift_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL -libc MD)
+set(CMAKE_Swift_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebug -libc MTd)
+set(CMAKE_Swift_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebugDLL -libc MDd)
+
set(CMAKE_Swift_FLAGS_DEBUG_INIT "-g")
set(CMAKE_Swift_FLAGS_RELEASE_INIT "-O")
set(CMAKE_Swift_FLAGS_RELWITHDEBINFO_INIT "-O -g")