[PATCH] cmake: link statically against run-time on windows (use /MT instead of /MD)

Hans Wennborg hans at chromium.org
Tue Nov 12 14:09:20 PST 2013


Hi rnk,

This brings down the list of clang's dll dependencies (as shown by "dumpbin /dependents") from:

    KERNEL32.dll
    SHELL32.dll
    ADVAPI32.dll
    MSVCP110.dll
    MSVCR110.dll
    dbghelp.dll

to:

    KERNEL32.dll
    SHELL32.dll
    ADVAPI32.dll
    dbghelp.dll

All of which should be available on Windows systems IIUC. This should fix the problem of snapshot builds not working for users who had MSVC 2010 instead of MSVC 2012 installed.

http://llvm-reviews.chandlerc.com/D2157

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,10 @@
   endif()
 endif()
 
+if(MSVC)
+  llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "/MD" "/MT")
+endif()  
+
 if(WIN32)
   if(CYGWIN)
     set(LLVM_ON_WIN32 0)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2157.1.patch
Type: text/x-patch
Size: 592 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131112/77302c4a/attachment.bin>


More information about the llvm-commits mailing list