1

I am trying to call "Clang compiler for Windows" installed by Visual Studio Installer from cmake command line. According to the platform toolset of an opned .sln file, this shall be clang-cl, but neither setting the -T flag of cmake to clang-cl nor LLVM works.

enter image description here

march_happy
  • 420
  • 5
  • 11

1 Answers1

4

What is the Platform Toolset name of LLVM installed by Visual Studio Installer in VS 2019?

For your situation, you cannot use "-T" to call the clang-cl and it is not in the supported toolset. You can use DCMAKE_CXX_COMPILER directly.

-T Toolset specification for the generator, if supported.

Some CMake generators support a toolset specification to tell the native build system how to choose a compiler. See the CMAKE_GENERATOR_TOOLSET variable for details.

Solution

Please try this:

cmake -G "Visual Studio 16 2019" -DCMAKE_CXX_COMPILER=clang-cl -p "CMakeLists.txt"

More info you can refer to this.

Update 1

It can be realized by -T and use clangcl instead of clang-cl. In toolset, LLVM is called clangcl.

cmake -G "Visual Studio 16 2019" -T clangcl

Hope it could help you.

Mr Qian
  • 21,064
  • 1
  • 31
  • 41