pacman -S --needed base-devel mingw-w64-i686-toolchain mingw-w64-x86_64-toolchain git subversion mercurial mingw-w64-i686-cmake mingw-w64-x86_64-cmake
Add C:\msys64\mingw64\bin and C:\msys64\mingw32\bin, in that order, to your PATH
add
C:\msys64\usr\bin
if needed
edit C:\msys64\msys2.ini
MSYS2_PATH_TYPE=inherit
References
https://github.com/orlp/dev-on-windows/wiki/Installing-GCC–&-MSYS2