The original MinGW distribution appears to no longer be maintained and
should not be used. Anyone still using MinGW should consider switching
to the MinGW-w64 fork or another actively maintained toolchain.
MinGW-w64 supports 64-bit binaries and provides much newer compilers and
Win32 headers.
Fixes#2540
This replaces some workarounds and manual logic with new features
available with CMake 3.16, including list(FILTER), list(JOIN),
foreach(IN LISTS) and enable_language(OBJC). Policy settings no longer
needed with 3.16 have been removed.
Related to #2541