The default CMake generator is for Visual Studio, since you want to use GCC, you may need to explicitly pick a different generator.
First make sure gcc, g++ and make/mingw32-make are in PATH.
Next delete the created build directory build/ to start with a clean setup.
Then instead of just running cmake -B build, run instead cmake -B build -G "MinGW Makefiles"