We don't support MSYS2 or Cygwin "subsystems" with our CMake build system, since they pretend to be Linux systems, while still requiring some special treatment, w.r.t. linking MinGW and not some common Linux libraries.
I think you can still reap the benefits of MSYS2 in some way, by not using the shell directly, but I'd have to check how. I've done so in the past to get auto tools on Windows, but maybe that was just MSYS and not MSYS2?