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 ________________________________ From: CMake <[email protected]> on behalf of Yi-Hong Lyu <[email protected]> Sent: Sunday, January 31, 2016 10:47:58 AM To: Nicholas Braden Cc: [email protected] Subject: Re: [CMake] Is there any way to use clang-cl with MSBuild on Windows? Hello Bill, If I generate the ALL_BUILD.vcxproj for MSVC 19.0.23506.0 as usual, I can use command "msbuild ALL_BUILD.vcxproj /p:cltoolexe=clang-cl" to build the project using clang-cl. However it might include wrong directory like C:\\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt during building when I build library libcxx. Is there any way to overwrite variables such as ExcludePath, IncludePath, UniversalCRT_IncludePath and VC_IncludePath? Hello Nicholas, Which value should I put for -T parameter? BTW, is CMAKE_TOOLCHAIN_FILE able to used in this situation? Thanks 2016-01-30 8:33 GMT+08:00 Nicholas Braden <[email protected]<mailto:[email protected]>>: Have you tried setting the toolset? The -T parameter can set the toolset. This sets the platform toolset property that you would normally set in Visual Studio. if Visual Studio lets you select the llvm platform toolset, so will CMake. On Fri, Jan 29, 2016 at 12:04 PM, Yi-Hong Lyu <[email protected]<mailto:[email protected]>> wrote: > Hello everyone, > > 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: > > $ cmake -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl > -DCMAKE_C_COMPILER_FORCED=ON -DCMAKE_CXX_COMPILER_FORCED=ON ..\src\ > -- Building for: Visual Studio 14 2015 > -- The CXX compiler identification is MSVC 19.0.23506.0 > -- The C compiler identification is MSVC 19.0.23506.0 > -- Configuring for standalone build. > -- Found PythonInterp: C:/Python34/python.exe (found version "3.4.4") > -- Sphinx disabled. > . > . > . > > PS. The environment PATH is already set to clang-cl. > > I am wondering whether there is any option that I can force MSBuild use > clang-cl instead. > > Thanks, > Yi-Hong > > -- > > Powered by > www.kitware.com<https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fwww.kitware.com&data=01%7c01%7cgilles.khouzam%40microsoft.com%7ce012a32391a44c18fbd108d32a6f1dea%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=XRBUVuD5E6oZzVuMZKnLIkpZvNpoUcAQxsxk%2b%2f3d2%2fg%3d> > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ<https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fwww.cmake.org%2fWiki%2fCMake_FAQ&data=01%7c01%7cgilles.khouzam%40microsoft.com%7ce012a32391a44c18fbd108d32a6f1dea%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=B5qRHx0tZ06282JI80v3vXtLe5dOEFMirfMf2cjuMPc%3d> > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: > http://cmake.org/cmake/help/support.html<https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fcmake.org%2fcmake%2fhelp%2fsupport.html&data=01%7c01%7cgilles.khouzam%40microsoft.com%7ce012a32391a44c18fbd108d32a6f1dea%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=nDxHnhnazcXg%2bWMTDqB21ZDzd%2bzHRP6GYMzXbUh23%2bw%3d> > CMake Consulting: > http://cmake.org/cmake/help/consulting.html<https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fcmake.org%2fcmake%2fhelp%2fconsulting.html&data=01%7c01%7cgilles.khouzam%40microsoft.com%7ce012a32391a44c18fbd108d32a6f1dea%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=zBgz7xNVTHlQt5Z8qD4%2bZbjHdHgUinxJucxqCNkVlb8%3d> > CMake Training Courses: > http://cmake.org/cmake/help/training.html<https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fcmake.org%2fcmake%2fhelp%2ftraining.html&data=01%7c01%7cgilles.khouzam%40microsoft.com%7ce012a32391a44c18fbd108d32a6f1dea%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=UuaSFCyTEAVLjHDdMEQJE4S9rQo8eCPKePrByhfFiyc%3d> > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html<https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fwww.kitware.com%2fopensource%2fopensource.html&data=01%7c01%7cgilles.khouzam%40microsoft.com%7ce012a32391a44c18fbd108d32a6f1dea%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=HL6JxxlNw6g74hoGamgZ%2bIMv4zW2d%2b5nj1So4W8jZqU%3d> > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake<https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fpublic.kitware.com%2fmailman%2flistinfo%2fcmake&data=01%7c01%7cgilles.khouzam%40microsoft.com%7ce012a32391a44c18fbd108d32a6f1dea%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=DsvpZHs%2bX%2fiEKMUAFifMucqlb67eDv1sac4LCBIm%2fPI%3d>
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
