MINGW: Define variable based on ABI check instead of compiler id
The MINGW variable indicates that the compiler targets MinGW, a GNU
ABI on Windows. Since the compiler's target may be affected by flags
known only after compiler identification (EDIT: only if CMAKE_<LANG>_COMPILER_TARGET is defined after compiler identification, such as the Android-Clang case in the motivating issue), delay defining the MINGW
variable until the ABI detection step.
Also remove the now-unused undocumented CMAKE_COMPILER_IS_MINGW
internal variable.
While at it, also remove redundant definitions of CYGWIN and UNIX variables on Cygwin.
These are set by modules loaded for CMAKE_SYSTEM_NAME. We do not
need to set them again if the compiler defines __CYGWIN__.
Fixes: #22647 (closed)
Edited by Brad King