<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Hi Cristian,<br>
      <br>
      That's what I did:<br>
      1) Created empty directory "D:\CL", moved clang-cl.exe there and
      renamed it to cl.exe.<br>
      2) Put the paths to cl.exe and Clang first in the global PATH
      environment variable. Set path to Clang Includes first in INCLUDE<br>
      3) Launched Cmake from an empty project dir.<br>
      <br>
      Still having the same issue. What am I doing wrong? Any ideas?<br>
      <br>
      ------ check that project dir is empty:<br>
      $dir<br>
      Directory of D:\-Work-\llvm-3.7.1.src\-CLANG-\ProjectDir<br>
      10.03.2016  00:31    <DIR>          .<br>
      10.03.2016  00:31    <DIR>          ..<br>
      10.03.2016  00:31                 0 out<br>
                     1 File(s)              0 bytes<br>
                     2 Dir(s)  874 200 309 760 bytes free<br>
      <br>
      ------ check PATH:<br>
      $set PATH<br>
      Path=D:\CL;D:\LLVM-3.7.1\bin;...<br>
      <br>
      ------ check INCLUDE:<br>
      $set INCLUDE<br>
      INCLUDE=D:\LLVM-3.7.1\lib\clang\3.7.1\include;C:\Program
      Files\Microsoft Visual Studio 12.0\VC\include<br>
      <br>
      ------ check which cl.exe is used:<br>
      $which cl<br>
      D:\CL\cl.EXE<br>
      <br>
      ------ trying to build:<br>
      $cmake -G "Ninja" -DCMAKE_C_COMPILER=clang
      -DCMAKE_CXX_COMPILER=clang ..<br>
      -- The C compiler identification is Clang 3.7.1<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:/LLVM-3.7.1/bin/clang.exe" is not able to
      compile a<br>
        simple test program.<br>
      <br>
        It fails with the following output:<br>
      <br>
         Change Dir:
      D:/-Work-/llvm-3.7.1.src/-CLANG-/ProjectDir/CMakeFiles/CMakeTmp<br>
      <br>
        Run Build Command:"C:/PROGRA~1/ninja/ninja.exe" "cmTC_c46bb"<br>
      <br>
        [1/2] Building C object
      CMakeFiles\cmTC_c46bb.dir\testCCompiler.c.obj<br>
      <br>
        FAILED: D:\LLVM-3.7.1\bin\clang.exe /nologo /DWIN32 /D_WINDOWS
      /W3 /D_DEBUG<br>
        /MDd /Zi /Ob0 /Od /RTC1 /showIncludes<br>
        /FoCMakeFiles\cmTC_c46bb.dir\testCCompiler.c.obj<br>
        /FdCMakeFiles\cmTC_c46bb.dir\ -c testCCompiler.c<br>
      <br>
        clang.exe: error: no such file or directory: '/nologo'<br>
      <br>
        clang.exe: error: no such file or directory: '/DWIN32'<br>
        ...<br>
      <br>
    </div>
    <blockquote
cite="mid:CA+u+m-+mE6CZtpWLT1X2Ca+ZgWGEv+8MQbR554j0gVg1LdR5PQ@mail.gmail.com"
      type="cite">
      <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 moz-do-not-send="true"
          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 moz-do-not-send="true"
                  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 moz-do-not-send="true"
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 moz-do-not-send="true"
                    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 moz-do-not-send="true"
                    href="http://www.cmake.org/Wiki/CMake_FAQ"
                    target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</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 moz-do-not-send="true"
                    href="http://cmake.org/cmake/help/support.html"
                    rel="noreferrer" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
                  CMake Consulting: <a moz-do-not-send="true"
                    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 moz-do-not-send="true"
                    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
                    moz-do-not-send="true"
                    href="http://www.kitware.com/opensource/opensource.html"
                    target="_blank"><a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a></a><br>
                  <br>
                  Follow this link to subscribe/unsubscribe:<br>
                  <a moz-do-not-send="true"
                    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>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
Anton</pre>
  </body>
</html>