xx
.md

os_msvc

os_msvc makes the native Microsoft Visual C++ compiler from the latest matching Visual Studio installation available to dependent tasks. It is a dependency, not a function, and takes no arguments.

On Windows, xx locates vswhere.exe under ${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer, uses it to find Visual Studio and the default MSVC toolset, and adds the native host tools directory to PATH. xx reports an error when vswhere.exe, Visual Studio, or the native MSVC tools are unavailable.

The symbol is safe to load on Linux and macOS, but activating it reports that Visual Studio is only available on Windows.

Example

load("@os@1", "os_msvc", "os_run")

os_run(("cl.exe",), deps=[os_msvc])