[PATCH] cmake: link statically against run-time on windows (use /MT instead of /MD)
Alp Toker
alp at nuanti.com
Tue Nov 12 14:40:46 PST 2013
Hans,
I've had /MT on in the unofficial testing builds for three days and it's
been a success without any obvious downside or major increase in binary
size, so from my viewpoint this is the way to go.
The patch will however need to handle all release configurations. This
is what I was using...
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)
STRING(REPLACE "/MD" "/MT" "${flag}" "${${flag}}")
SET("${flag}" "${${flag}} /EHsc")
ENDFOREACH()
I wonder if it's possible to just handle this using the CMAKE_CXX_FLAGS
variable common to all build configurations?
Alp.
On 12/11/2013 22:09, Hans Wennborg wrote:
> 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)
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
--
http://www.nuanti.com
the browser experts
More information about the llvm-commits
mailing list