In order to use CMake + Ninja + MSVC (The Visual Studio Compiler) you need to startup a developer command prompt.
Which under the hood is really calling vcvarsall.bat
which is found in a visual studio installation.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat
How can I do this via GitHub actions?
Currently we use https://github.com/ilammy/msvc-dev-cmd to setup the developer command prompt for our C++ projects. It works quite well and has a nice interface.
I'm not sure if this is the most idiomatic solution but it has been working quite nicely so far.
This approach also updates nicely when updating the runner image. Since ilammy/msvc-dev-cmd
uses vswhere
under the hood.