[CMake] Is there any way to use clang-cl with MSBuild on Windows?

Yi-Hong Lyu b95705030 at ntu.edu.tw
Wed Feb 3 14:10:44 EST 2016


Hello Gilles,

Thanks for you mail. It is really useful to me but I encounter an error. My
use case is to use clang-cl with my own target instead of x86/x64 target.
Therefore I don't want to include any headers of VS x86/x64 and use any
library of VS x86/x64:

PS > cmake -G "Visual Studio 14 2015" -T v140_clang_3_7
-DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl ..\src\

CMake Error at CMakeLists.txt:17 (project):
  Could not find an appropriate version of the Windows 10 SDK installed
on this machine

-- Configuring incomplete, errors occurred!
See also "E:/libcxx/b-libcxx-Cascade-msbuild2/CMakeFiles/CMakeOutput.log".

I don't want to use Windows 10 SDK during compilation. Is the feature you
implemented suitable for my special use case?

Thanks for your help,
Yi-Hong

2016-02-01 22:47 GMT+08:00 Gilles Khouzam <Gilles.Khouzam at microsoft.com>:

> Hi Yi-Long
>
>
> Clang-Cl requires a few changes in order to work properly,
>
>
> I've prototyped the support for Clang-Cl on our CMake fork with the plan
> to integrate the support once we've got good confirmation and work through
> some of the design issues.
>
>
> You can find the code on
> https://github.com/microsoft/cmake/tree/feature/clang_3_7
>
>
> You can also find an installer here:
> https://github.com/Microsoft/CMake/releases
>
>
> The easiest way to set Clang as the compiler is to use the -T parameter
> such as
>
> cmake -G "Visual Studio 14 2015" -T v140_clang_3_7 ...
>
>
> But I've also added a new variable VS_PLATFORM_TOOLSET_OVERRIDE that you
> can use to change the toolset for a specific target (there are scenarios
> where you need CL and Clang targeting different projects in your solution).
>
>
> Thanks
>
>
> ~Gilles
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160204/8d2f9d7d/attachment.html>


More information about the CMake mailing list