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

Gilles Khouzam Gilles.Khouzam at microsoft.com
Wed Feb 3 14:25:39 EST 2016


Hi Yi-Hong,

Can you try to add the following: -DCMAKE_SYSTEM_VERSION=8.1 to your parameters?

From: Yi-Hong Lyu [mailto:b95705030 at ntu.edu.tw]
Sent: Wednesday, February 3, 2016 11:11
To: Gilles Khouzam <Gilles.Khouzam at microsoft.com>
Cc: Nicholas Braden <nicholas11braden at gmail.com>; cmake at cmake.org
Subject: Re: [CMake] Is there any way to use clang-cl with MSBuild on Windows?

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<mailto: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/20160203/4ef79f16/attachment-0001.html>


More information about the CMake mailing list