How to Enable CMake parallel compile

I try to parallel compile a c++ project with Visual Studio 2022. However It cost 4 minute in Visual Studio2022 or using command instead of 1minute in VSCode, VisualStudio2022 and using command will cost more time and less CPU,which is likely unable parallel compile.

Below is the environment and cmake configure:
CMakeList.txt:

cmake_minimum_required(VERSION 3.22)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_GENERATOR	"MinGW Makefiles")
set(CMAKE_BUILD_PARALLEL_LEVEL 12)
find_program(CMAKE_CXX_COMPILER "${mingw_tools}/bin/g++.exe" )
find_program(CMAKE_C_COMPILER "${mingw_tools}/bin/gcc.exe" )		
find_program(CMAKE_MAKE_PROGRAM "${mingw_tools}/bin/mingw32-make.exe")

The command I use to test parallel compiling, but it is still cost 4 minute:

cmake --preset x64-debug -B build
cmake --build build --config Debug

However Using same CmakeLists.txt file with VSCode, I compile the project only cost 1 minute,

You can’t set the generator this way. The project cannot choose the generator. The user selects it with the -G option when running the cmake executable, or as part of a CMake preset. An example of setting it via the command line:

cmake -G "MinGW Makefiles" ...

This also can’t be set by the project. CMAKE_BUILD_PARALLEL_LEVEL needs to be set as an environment variable when running the build step using cmake --build. You can also set this in a CMake preset, but projects shouldn’t do that because they can’t know the capabilities of the developer’s machine.

These should generally only be set after the first project() call (this is also missing from your example).

These should not be set by the project. They should be set in a toolchain file instead. They can be set on the command line or in a CMake preset, but I’d recommend using a toolchain file instead.

This also shouldn’t be set by the project. It should be set by the user on the cmake command line.

Actually,It is part of my CMakeLists.txt file. I used to set CMAKE_BUILD_PARALLEL_LEVEL on preset, but parallel compiling still is not working.