CMake does not find LLVM toolchain

tgq's Avatar


01 Oct, 2020 03:21 PM

Hello. I've read that clang is integrated into Visual Studio image, but it doesn't want to cooperate with cmake.
My build script calls a line:
cmake .. -DCMAKE_TOOLCHAIN_FILE=c:/tools/vcpkg/scripts/buildsystems/vcpkg.cmake -TLLVM which ends with error

-- Building for: Visual Studio 16 2019
CMake Error at CMakeLists.txt:3 (project):
  Failed to run MSBuild command:
    C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/MSBuild.exe
  to get the value of VCTargetsPath:
    Microsoft (R) Build Engine version 16.7.0+b89cb5fde for .NET Framework
    Copyright (C) Microsoft Corporation. All rights reserved.

Build started 10/1/2020 3:15:02 PM.
Project "C:\projects\appveyor-playground\build\CMakeFiles\3.18.3\VCTargetsPath.vcxproj" on node 1 (default targets).
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(411,5): error MSB8020: The build tools for LLVM (Platform Toolset = 'LLVM') cannot be found. To build using the LLVM build tools, please install LLVM build tools.  Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution". [C:\projects\appveyor-playground\build\CMakeFiles\3.18.3\VCTargetsPath.vcxproj]
Done Building Project &quot;C:\projects\appveyor-playground\build\CMakeFiles\3.18.3\VCTargetsPath.vcxproj&quot; (default targets) -- FAILED.</code>

I've also tried llvm and LLVM_v142, neither works. What is the exact toolchain name to pass to cmake invocation?

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac