In the code below, constantset_a.h and constantset_b.h define the same set of global constants but sets the constants with different values. Compiled myprogram.exe is to behave differently depending on the global constant values they were compiled with.

My question is, is there any way that I can use MSBUILD to set CONSTANTSET_A and build, and then set CONSTANTSET_B and then build again, and for the compiled binaries to have different names? I need this to be done in a single compile pass (i.e. compiling two different binaries with one build /c /z command), since my codes will be compiled along with other people's codes in the team-wide automated build process.

EDIT: Just realized you are using MSBUILD not make. The principle is the same, but the syntax will be different. You still need 2 build targets, plus enable the default build target to build them both.