Don't set environment variables manually (
PATH
, PKG_CONFIG_PATH
, ...). Open MSYS2 MINGW64
terminal in the Start menu and they'll be set for you. Install CMake in MSYS2 (pacman -S mingw-w64-x86_64-cmake
) and use it instead of the official one, at the very least it defaults to using MSYS2 compilers instead of MSVC.