If the build system ninja is available:
cmake -S . -B build -G"Ninja Multi-Config"
cmake --build build --config Debug
cmake --build build --config ReleaseOtherwise, just rely on the default generator (typically Makefiles):
cmake -S . -B build-d -DCMAKE_BUILD_TYPE=Debug
cmake --build build-dcmake -S . -B build-o -DCMAKE_BUILD_TYPE=Release
cmake --build build-oThe build artifacts (e.g. executables) are in the build directory.