Block building for the wrong target arch in Developer Command Prompt by cpplearner · Pull Request #5731 · microsoft/STL (original) (raw)

#4709 and #4717 make it impossible to build in the wrong command prompt (e.g. if someone builds the STL in an "x64 Native Tools Command Prompt" and runs the tests in an "x86 Native Tools Command Prompt"). But they are ineffective in a "Developer Command Prompt" because they examine the Platform env var, which is not defined there.

This PR examines VSCMD_ARG_TGT_ARCH instead, which is defined in both the Developer Command Prompt and the Native Tools Command Prompt.

It's unclear to me whether it is safe to use such an undocumented env var. But anyway, if someone encounters an unexpected error, they can just manually unset VSCMD_ARG_TGT_ARCH when building.