<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 29-Jan-16 19:04, Yi-Hong Lyu wrote:<br>
</div>
<blockquote
cite="mid:CAH1oQ8oHo=eH5mxZiE5GPTC2pb4BEXU1vfJRBec5GK8QLA3p9g@mail.gmail.com"
type="cite">
<div dir="ltr">Hello everyone,<br>
<br>
I am a newbie of CMake. I would like to use clang-cl with
MSBuild on Windows. However it always use MSVC 19.0.23506.0 as
the identified compiler even I defined CMAKE_C_COMPILER /
CMAKE_CXX_COMPILER / CMAKE_C_COMPILER_FORCED /
CMAKE_CXX_COMPILER_FORCED:<br>
<br>
$ cmake -DCMAKE_C_COMPILER=clang-cl
-DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_C_COMPILER_FORCED=ON
-DCMAKE_CXX_COMPILER_FORCED=ON ..\src\<br>
<font color="#ff0000">-- Building for: Visual Studio 14 2015<br>
-- The CXX compiler identification is MSVC 19.0.23506.0<br>
-- The C compiler identification is MSVC 19.0.23506.0</font><br>
-- Configuring for standalone build.<br>
-- Found PythonInterp: C:/Python34/python.exe (found version
"3.4.4")<br>
-- Sphinx disabled.<br>
.<br>
.<br>
.<br>
<br>
PS. The environment PATH is already set to clang-cl.<br>
<br>
I am wondering whether there is any option that I can force
MSBuild use clang-cl instead.<br>
<br>
Thanks,<br>
Yi-Hong<br>
</div>
<br>
</blockquote>
<br>
I use clang-cl with ninja. Open a Visual Studio 2013 command prompt
window and then set:<br>
<br>
<pre style="margin: 0px; padding: 1em; border: 1px solid rgb(238, 238, 238); font-style: normal; font-variant: normal; font-weight: normal; font-stretch: inherit; line-height: 1.45em; font-family: 'Source Code Pro', monospace; font-size: 13px; vertical-align: baseline; border-radius: 0.4em; color: rgb(51, 51, 51); overflow-x: auto; overflow-y: hidden; box-shadow: none; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px; background: url("/images/noise.png?1430483548") 0% 0% rgb(246, 246, 246);">$ set PATH=C:\Program Files (x86)\LLVM\msbuild-bin\;%PATH%
$ set INCLUDE=C:\Program Files (x86)\LLVM\lib\clang\3.7.0\include\;%INCLUDE%
</pre>
<br>
The same can be done with Qt Creator and a cloned Visual C++ kit,
but in the environment settings instead of %PATH% and %INCLUDE% use<br>
$(PATH) and $(INCLUDE).<br>
<br>
Cheers,<br>
Cristian.<br>
<br>
</body>
</html>