[llvm] r194589 - cmake: link release builds statically against run-time library on windows (use /MT instead of /MD)
Hans Wennborg
hans at hanshq.net
Wed Nov 13 10:16:23 PST 2013
Author: hans
Date: Wed Nov 13 12:16:23 2013
New Revision: 194589
URL: http://llvm.org/viewvc/llvm-project?rev=194589&view=rev
Log:
cmake: link release builds statically against run-time library on windows (use /MT instead of /MD)
This should fix the problem of snapshot builds created with MSVC 2012 not
working for users with MSVC 2010, etc.
Differential Revision: http://llvm-reviews.chandlerc.com/D2157
Modified:
llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
Modified: llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/HandleLLVMOptions.cmake?rev=194589&r1=194588&r2=194589&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/HandleLLVMOptions.cmake (original)
+++ llvm/trunk/cmake/modules/HandleLLVMOptions.cmake Wed Nov 13 12:16:23 2013
@@ -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)
More information about the llvm-commits
mailing list