[cfe-users] clang-cl choosing VC++ backend on Windows

Hans Wennborg via cfe-users cfe-users at lists.llvm.org
Thu Jul 25 09:29:14 PDT 2019


On Mon, Jul 22, 2019 at 3:29 PM Edward Diener via cfe-users
<cfe-users at lists.llvm.org> wrote:
>
> Given multiple installations installed of Visual Studio/VC++ on Windows,
> with none of them normally in the PATH, how does clang-cl choose which
> one to use at compile/link time as the clang backend ?

It's a bit involved. You can find the code here:
http://llvm-cs.pcc.me.uk/tools/clang/lib/Driver/ToolChains/MSVC.cpp#709

Clang first looks for environment variables VCToolsInstallDir or
VCINSTALLDIR which are usually set by vcvarsall.bat (or if you launch
a Visual Studio Native Tools Command Prompt). If those aren't set, it
looks on PATH.

After that, it queries the "Visual Studio Setup Configuration Server",
and after that it checks the registry.


If you want to point Clang to use a specific Visual Studio install,
the best way is to set the environment variables the way vcvarsall.bat
sets them.

Hope that helps,
Hans



More information about the cfe-users mailing list