Linking to ASan for MinGW is similar to MSVC, but MinGW always links the CRT dynamically, so there is only one of the MSVC cases to consider.
When linking to a shared compiler runtime library on MinGW, the suffix of the import library is .dll.a.
The existing case of .dll as suffix for windows in general doesn't seem correct (since this is used for linking). As long as callers never actually set the Shared flag, the default static suffix of .lib also worked fine for import libraries as well.
I think these conditionals have outgrown conditional expressions. Maybe just patch it upafterwards with a special case: