[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:31 PST 2013
On Tue, Nov 12, 2013 at 2:40 PM, Alp Toker <alp at nuanti.com> wrote:
> 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.
Great!
> 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()
Hmm, yeah maybe we should.. I've updated the patch.
> I wonder if it's possible to just handle this using the CMAKE_CXX_FLAGS
> variable common to all build configurations?
I tried that, but then I ended up with "/MT /MD". I guess cmake picks
up /MT from CMAKE_CXX_FLAGS, and then /MD from CMAKE_CXX_FLAGS_RELEASE
:(
Cheers,
Hans
More information about the llvm-commits
mailing list