cmake: limit some macros to mingw Syncing this up with autotools. Also use the built-in `MINGW` variable.