NoSenseEtAl
NoSenseEtAl

Reputation: 30138

clang-cl and CMAKE

I tried to build simple program with CMAKE using clang on Windows, but CMAKE gave me error.

CMake Error at C:/Program Files/CMake/share/cmake-3.14/Modules/CMakeDetermineCompilerId.cmake:859 (message): The Clang compiler tool

"C:/Program Files/LLVM/bin/clang++.exe"

targets the MSVC ABI but has a GNU-like command-line interface. This is not supported. Use 'clang-cl' instead, e.g. by setting 'CXX=clang-cl' in the environment.

So I tried to set CXX=clang-cl enviromental variable but it still does not work(same error message), although env variable is set

echo %CXX%

clang-cl

So my question is: is there a way to get CMAKE to work with clang-cl or clang on Windows.

Upvotes: 1

Views: 3095

Answers (1)

sosssego
sosssego

Reputation: 71

In cmake-gui you can choose clangcl on optional tool set -T. It is very confuse because on Visual Studio it is called llvm (clang-cl) and not clangcl. I tried many options and found the platform tool set folder in visual studio folder with the name clangcl. Using cmake-gui it worked fine for me, I think it should also work in the command line.

Upvotes: 2

Related Questions