summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/HandleLLVMOptions.cmake10
1 files changed, 10 insertions, 0 deletions
diff --git a/cmake/modules/HandleLLVMOptions.cmake b/cmake/modules/HandleLLVMOptions.cmake
index bb41a58..ff71c00 100644
--- a/cmake/modules/HandleLLVMOptions.cmake
+++ b/cmake/modules/HandleLLVMOptions.cmake
@@ -5,6 +5,7 @@
include(AddLLVMDefinitions)
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
+include(LLVMProcessSources)
if( CMAKE_COMPILER_IS_GNUCXX )
set(LLVM_COMPILER_IS_GCC_COMPATIBLE ON)
@@ -40,6 +41,15 @@ else()
endif()
endif()
+if(MSVC)
+ # Link release builds against the static runtime.
+ foreach(flag CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO
+ CMAKE_C_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELEASE
+ CMAKE_CXX_FLAGS_RELWITHDEBINFO CMAKE_CXX_FLAGS_MINSIZEREL)
+ llvm_replace_compiler_option("${flag}" "/MD" "/MT")
+ endforeach()
+endif()
+
if(WIN32)
if(CYGWIN)
set(LLVM_ON_WIN32 0)