If the build system ninja is available:
cmake -S . -B build -G"Ninja Multi-Config"
cmake --build build --config Debug
cmake --build build --config ReleaseThe build artifacts (e.g. executables) are in the build/Debug and build/Release directories, respectively.
Otherwise, 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-d and build-o directories, respectively.