[PATCH] cmake: link statically against run-time on windows (use /MT instead of /MD)
Hans Wennborg
hans at chromium.org
Tue Nov 12 15:05:51 PST 2013
Do the foreach thing to handle all flag variables.
Hi rnk,
http://llvm-reviews.chandlerc.com/D2157
CHANGE SINCE LAST DIFF
http://llvm-reviews.chandlerc.com/D2157?vs=5479&id=5481#toc
Files:
cmake/modules/HandleLLVMOptions.cmake
Index: cmake/modules/HandleLLVMOptions.cmake
===================================================================
--- cmake/modules/HandleLLVMOptions.cmake
+++ 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,16 @@
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_C_FLAGS_MINSIZEREL_INIT
+ CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO
+ CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_MINSIZEREL_INIT)
+ llvm_replace_compiler_option("${flag}" "/MD" "/MT")
+ endforeach()
+endif()
+
if(WIN32)
if(CYGWIN)
set(LLVM_ON_WIN32 0)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2157.2.patch
Type: text/x-patch
Size: 907 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131112/bef9480f/attachment.bin>
More information about the llvm-commits
mailing list