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

Hans Wennborg hans at chromium.org
Wed Nov 13 10:22:38 PST 2013


On Wed, Nov 13, 2013 at 2:31 AM, Alp Toker <alp at nuanti.com> wrote:
>
> On 13/11/2013 02:04, Hans Wennborg wrote:
>> On Tue, Nov 12, 2013 at 4:30 PM, Alp Toker <alp at nuanti.com> wrote:
>>> I just noticed it might make sense to do this for /MDd /MTd in _DEBUG as
>>> well.
>> Hmm, spontaneously I think this mostly makes sense for release builds,
>> since that's what gets distributed, and I'd rather stick to the
>> default for debug builds. I don't really have a strong opinion here,
>> though.
>
> Right. Let's keep DEBUG out for now then. However..
>
>>> Also the MINSIZEREL_INIT cases that slipped in shouldn't be necessary.
>> OK, I'll remove those.
>>
>>> llvm_replace_compiler_option() does a word replace so the easier way to
>>> handle all cases would just be to do the replacement directly, something
>>> like the following:
>> I kind of like llvm_replace_compiler_option() though, because it will
>> add the new option even in cases where the old option didn't exist.
>
> I kind of like the direct replace version, just because it's what's used
> in the CMake samples in cmake.git and conceivably if there's no /MD (say
> when invoking the MSVC analyzer) it'd be wrong to append /MT.
>
> I'll let you take it from here, from my POV any one of the solutions is
> good and we can refine it as we go.

OK, I've committed the last version of my patch for now (r194589).

I don't care much about how this is done, as long as the snapshot
builds work for users, so if anyone feels more strongly about the best
way to do this in cmake, feel free to change it :)

Thanks,
Hans



More information about the llvm-commits mailing list