<p dir="ltr">Hi Anton,</p>
<p dir="ltr">When I say clang-cl I mean how the official llvm package does it - a 50mb executable named cl.exe and not clang-cl.exe.</p>
<p dir="ltr">Ninja believes it compiles with visual c++, but instead it compiles with clang. That's why you need to put the path to clang INCLUDE and PATH first.</p>
<p dir="ltr">Simply rename clang-cl.exe as cl.exe, copy it in a directory and put that path as first in the PATH environment variable.</p>
<p dir="ltr">Cheers,<br>
Cristian.</p>
<div class="gmail_quote">On Mar 4, 2016 12:16, "Anton Yartsev" <<a href="mailto:anton.yartsev@gmail.com">anton.yartsev@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    <div>Hi Cristian,<br>
      <br>
      thanks for the replay. I have clang-cl first in PATH, the problem
      persists.<br>
      <br>
      $ SET PATH<br>
      Path=D:\-Work-\llvm-3.7.1.src\-VS_build VS 2013-\Release\bin;...<br>
      <br>
      $cd D:\-Work-\llvm-3.7.1.src\-VS_build VS 2013-\Release\bin<br>
      $dir<br>
       Directory of D:\-Work-\llvm-3.7.1.src\-VS_build VS
      2013-\Release\bin<br>
      <br>
      04.03.2016  14:03    <DIR>          .<br>
      04.03.2016  14:03    <DIR>          ..<br>
      04.03.2016  01:00        11 662 848 arcmt-test.exe<br>
      04.03.2016  01:02         6 446 080 bugpoint.exe<br>
      04.03.2016  01:01             9 728 c-arcmt-test.exe<br>
      04.03.2016  01:01            82 944 c-index-test.exe<br>
      04.03.2016  17:20        40 207 872 clang++.exe<br>
      04.03.2016  01:01        32 803 840 clang-check.exe<br>
      04.03.2016  17:20        40 207 872 clang-cl.exe<br>
      04.03.2016  01:00         1 401 856 clang-format.exe<br>
      04.03.2016  17:05           814 592 clang-tblgen.exe<br>
      04.03.2016  17:20        40 207 872 clang.exe<br>
      ...<br>
      <br>
      <br>
    </div>
    <blockquote type="cite">
      <p dir="ltr">Hi Anton,</p>
      <p dir="ltr">clang.exe doesn't know of any windows specific
        things.  Clang-cl instead does.</p>
      <p dir="ltr">Just make sure to have clang-cl before msvc-cl in
        path and ninja will just work.</p>
      <p dir="ltr">Cheers,<br>
        Cristian</p>
      <div class="gmail_quote">On Mar 4, 2016 01:31, "Anton Yartsev"
        <<a href="mailto:anton.yartsev@gmail.com" target="_blank">anton.yartsev@gmail.com</a>>
        wrote:<br type="attribution">
        <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
          <br>
          I'm trying to use Clang, compiled with VS 2013
          (configuration:Release, platform:x64) as a C/C++ compiler for
          a simple HelloWorld CMake project. Generation ends up with
          errors like "clang.exe: error: no such file or directory:
          '/DWIN32'" at compiler check stage. If I understand correctly
          the problem is that MSVC compiler options are fed to Clang for
          some reason (maybe the "-- The C compiler identification is
          unknown" log entry is related to the problem?).<br>
          Could anyone help to resolve this, please?<br>
          <br>
          I also tried to change compiler ID with
          "-DCMAKE_C_COMPILER_ID=Clang -DCMAKE_CXX_COMPILER_ID=Clang",
          then compilation succeeded, but linkage failed (just as
          described in the thread "Question on usage of cmake on Windows
          with clang" <a href="http://thread.gmane.org/gmane.comp.programming.tools.cmake.user/54650" rel="noreferrer" target="_blank">http://thread.gmane.org/gmane.comp.programming.tools.cmake.user/54650</a>).
          Here the problem seems to be reversed: GNU linker options are
          fed to MS linker.<br>
          <br>
          ************** Setup and details:<br>
          1) INCLUDE and PATH set to clang/clang-cl<br>
          2) command line environment is configured with vsvars32.bat<br>
          3) CC and CXX set to clang<br>
          <br>
          $ cat CMakeLists.txt<br>
          project(test_project)<br>
          add_executable(main file.cpp)<br>
          <br>
          $ cmake -G "Ninja" -DCMAKE_C_COMPILER=clang
          -DCMAKE_CXX_COMPILER=clang ..<br>
          <br>
          Log:<br>
          -- The C compiler identification is unknown<br>
          -- The CXX compiler identification is Clang 3.7.1<br>
          -- Check for working C compiler using: Ninja<br>
          -- Check for working C compiler using: Ninja -- broken<br>
          CMake Error at C:/Program
          Files/CMake/share/cmake-3.5/Modules/CMakeTestCCompiler.cmake:61
          (message):<br>
            The C compiler "D:/-Work-/llvm-3.7.1.src/-VS_build VS<br>
            2013-/Release/bin/clang.exe" is not able to compile a simple
          test program.<br>
            It fails with the following output:<br>
             Change Dir:
          D:/-Work-/llvm-3.7.1.src/-CLANG-/CMakeFiles/CMakeTmp<br>
          <br>
            Run Build Command:"C:/PROGRA~1/ninja/ninja.exe" "cmTC_2cb9d"<br>
          <br>
            [1/2] Building C object
          CMakeFiles\cmTC_2cb9d.dir\testCCompiler.c.obj<br>
          <br>
            FAILED:
          D:\-Work-\LLVM-3~2.SRC\-VS_BU~2\Release\bin\clang.exe /DWIN32<br>
            /D_WINDOWS /W3 -o
          CMakeFiles\cmTC_2cb9d.dir\testCCompiler.c.obj -c<br>
            testCCompiler.c<br>
          <br>
            clang.exe: error: no such file or directory: '/DWIN32'<br>
            clang.exe: error: no such file or directory: '/D_WINDOWS'<br>
          ...<br>
          <br>
          OS: Windows 7 (x64)<br>
          <br>
          clang version 3.7.1 (tags/RELEASE_371/final)<br>
          Target: x86_64-pc-windows-msvc<br>
          Thread model: posix<br>
          <br>
          cmake version 3.5.0-rc3<br>
          <br>
          Thank you!<br>
          <br>
          -- <br>
          Anton<br>
          <br>
          -- <br>
          <br>
          Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
          <br>
          Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank"><a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a></a><br>
          <br>
          Kitware offers various services to support the CMake
          community. For more information on each offering, please
          visit:<br>
          <br>
          CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
          CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
          CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
          <br>
          Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank"><a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a></a><br>
          <br>
          Follow this link to subscribe/unsubscribe:<br>
          <a href="http://public.kitware.com/mailman/listinfo/cmake" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/cmake</a><br>
        </blockquote>
      </div>
    </blockquote>
    <br>
    <br>
    <pre cols="72">-- 
Anton</pre>
  </div>

</blockquote></div>