The x64 versus arm64 stuff seems to be handled pretty well by the CMakeSettings.json configuration “inheritEnvironments” value, but there are no defined values for inheritEnvironments to set up the build for UWP.
I ended up writing a big BAT file and invoking it from add_custom_target in CMakeLists.txt
That BAT then does a CALL VCVARSALL.BAT to set up the environment – including the UWP argument, and then calls ninja to rebuild with that environment (with the proper library paths etc.). To protect itself from recursion, my BAT immediately looks for a _BUILD_RECURSION_GUARD.TXT file. If it exists, the BAT exits immediately. If it doesn’t exit, the BAT creates it, then finally deletes it at the end.
A total ugly kluge, but it seems to work. I have not found a better way the set up the VCVARSALL environment for UWP in a Visual Studio CMake project. I’ve done a whole lot of BAT scripting to work around various problems.