[CMake] Problem using VS-compiled Clang as a C/C++ compiler.

Dan Liew dan at su-root.co.uk
Wed Mar 9 17:26:04 EST 2016


> ------ check which cl.exe is used:
> $which cl
> D:\CL\cl.EXE
>
> ------ trying to build:
> $cmake -G "Ninja" -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang ..

If your goal is use your renamed clang-cl (cl.exe) then why are you
telling CMake to use to use clang.exe ?

You can clearly see if your error message that ``clang.exe`` is being invoked.

Shouldn't your command line be something like this?

CC=cl.exe CXX=cl.exe cmake -G "Ninja" ..

If you want to be really specific you could do

CC=D:\LLVM-3.7.1\bin\clang-cl.exe CXX=D:\LLVM-3.7.1\bin\clang-cl.exe
cmake -G "Ninja" ..


More information about the CMake mailing list