repeat variable

Is it a good method for declare twice set build_type?

set build_type=release
cmake -Dbuild-type=%build_type%

set build_type=debug
cmake -Dbuild-type=%build_type%

Because c++ only declare 1 times.

int a=0;
dosomething;

a=2;
dosomething;

This will configure two CMake build trees in the same place. Basically, the build_type=release gets overwritten with build_type=debug in the code you’ve shown.

I want to build release and debug version.
I rewrite the camke

set build_type=release
cmake -B build-release -Dbuild-type=%build_type% -Dprefix_path=../%build_type%

set build_type=debug
cmake -B build-debug -Dbuild-type=%build_type% -Dprefix_path=../%build_type%

That would work because there are two different build directories.

Thanks