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

Gilles Khouzam Gilles.Khouzam at microsoft.com
Wed Feb 3 17:16:37 EST 2016


Hi Yi-Hong,

I think that this is an issue that was recently fix in CMake which is not in our fork. I’ll look at pulling in this change in our branch.

From: Yi-Hong Lyu [mailto:b95705030 at ntu.edu.tw]
Sent: Wednesday, February 3, 2016 11:46
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,

Here it is:

PS > cmake -G "Visual Studio 14 2015" -T v140_clang_3_7 -DLLVM_PATH="E:\\llvm" -DCMAKE_SYSTEM_VERSION=8.1  -DCMAKE_C_COMPILER="E:\\e2tools\\ext-tools\\llvm\\clang-cl.exe" -DCMAKE_CXX_COMPILER="E:\\e2tools\\ext-tools\\llvm\\clang-cl.exe" ..\src\
-- The CXX compiler identification is unknown
-- The C compiler identification is unknown
-- Check for working CXX compiler using: Visual Studio 14 2015
-- Check for working CXX compiler using: Visual Studio 14 2015 -- broken
CMake Error at E:/CMake/clang_3_7/Modules/CMakeTestCXXCompiler.cmake:54 (message):
  The C++ compiler "E:\e2tools\ext-tools\llvm\clang-cl.exe" is not able to
  compile a simple test program.

  It fails with the following output:

   Change Dir: E:/libcxx/b-libcxx-Cascade-msbuild2/CMakeFiles/CMakeTmp

  Run Build Command:"C:/Program Files (x86)/MSBuild/14.0/bin/MSBuild.exe"
  "cmTC_00a23.vcxproj" "/p:Configuration=Debug" "/p:VisualStudioVersion=14.0"

  Microsoft (R) Build Engine version 14.0.24720.0

  C:\Program Files
  (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.Cpp.Platform.targets(57,5):
  error MSB8020: The build tools for v140_clang_3_7 (Platform Toolset =
  'v140_clang_3_7') cannot be found.  To build using the v140_clang_3_7 build
  tools, please install v140_clang_3_7 build tools.  Alternatively, you may
  upgrade to the current Visual Studio tools by selecting the Project menu or
  right-click the solution, and then selecting "Retarget solution".
  [E:\libcxx\b-libcxx-Cascade-msbuild2\CMakeFiles\CMakeTmp\cmTC_00a23.vcxproj]

    C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.Cpp.Platform.targets(57,5): error MSB8020: The build tools for v140_clang_3_7 (Platform Toolset = 'v140_clang_3_7') cannot be found. To build using the v140_clang_3_7 build tools, please install v140_clang_3_7 build tools.  Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution". [E:\libcxx\b-libcxx-Cascade-msbuild2\CMakeFiles\CMakeTmp\cmTC_00a23.vcxproj]

      0 warning
      1 error

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:17 (project)

-- Configuring incomplete, errors occurred!

PS. Part of the messages in Chinese are removed, please tell me if you need it as well

Thanks for your help,
Yi-Hong

2016-02-04 3:25 GMT+08:00 Gilles Khouzam <Gilles.Khouzam at microsoft.com<mailto:Gilles.Khouzam at microsoft.com>>:
Hi Yi-Hong,

Can you try to add the following: -DCMAKE_SYSTEM_VERSION=8.1 to your parameters?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160203/5298ac7c/attachment-0001.html>


More information about the CMake mailing list