Hi Anton, 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.
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. Simply rename clang-cl.exe as cl.exe, copy it in a directory and put that path as first in the PATH environment variable. Cheers, Cristian. On Mar 4, 2016 12:16, "Anton Yartsev" <anton.yart...@gmail.com> wrote: > Hi Cristian, > > thanks for the replay. I have clang-cl first in PATH, the problem persists. > > $ SET PATH > Path=D:\-Work-\llvm-3.7.1.src\-VS_build VS 2013-\Release\bin;... > > $cd D:\-Work-\llvm-3.7.1.src\-VS_build VS 2013-\Release\bin > $dir > Directory of D:\-Work-\llvm-3.7.1.src\-VS_build VS 2013-\Release\bin > > 04.03.2016 14:03 <DIR> . > 04.03.2016 14:03 <DIR> .. > 04.03.2016 01:00 11 662 848 arcmt-test.exe > 04.03.2016 01:02 6 446 080 bugpoint.exe > 04.03.2016 01:01 9 728 c-arcmt-test.exe > 04.03.2016 01:01 82 944 c-index-test.exe > 04.03.2016 17:20 40 207 872 clang++.exe > 04.03.2016 01:01 32 803 840 clang-check.exe > 04.03.2016 17:20 40 207 872 clang-cl.exe > 04.03.2016 01:00 1 401 856 clang-format.exe > 04.03.2016 17:05 814 592 clang-tblgen.exe > 04.03.2016 17:20 40 207 872 clang.exe > ... > > > Hi Anton, > > clang.exe doesn't know of any windows specific things. Clang-cl instead > does. > > Just make sure to have clang-cl before msvc-cl in path and ninja will just > work. > > Cheers, > Cristian > On Mar 4, 2016 01:31, "Anton Yartsev" <anton.yart...@gmail.com> wrote: > >> Hi all, >> >> 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?). >> Could anyone help to resolve this, please? >> >> 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" >> http://thread.gmane.org/gmane.comp.programming.tools.cmake.user/54650). >> Here the problem seems to be reversed: GNU linker options are fed to MS >> linker. >> >> ************** Setup and details: >> 1) INCLUDE and PATH set to clang/clang-cl >> 2) command line environment is configured with vsvars32.bat >> 3) CC and CXX set to clang >> >> $ cat CMakeLists.txt >> project(test_project) >> add_executable(main file.cpp) >> >> $ cmake -G "Ninja" -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang .. >> >> Log: >> -- The C compiler identification is unknown >> -- The CXX compiler identification is Clang 3.7.1 >> -- Check for working C compiler using: Ninja >> -- Check for working C compiler using: Ninja -- broken >> CMake Error at C:/Program >> Files/CMake/share/cmake-3.5/Modules/CMakeTestCCompiler.cmake:61 (message): >> The C compiler "D:/-Work-/llvm-3.7.1.src/-VS_build VS >> 2013-/Release/bin/clang.exe" is not able to compile a simple test >> program. >> It fails with the following output: >> Change Dir: D:/-Work-/llvm-3.7.1.src/-CLANG-/CMakeFiles/CMakeTmp >> >> Run Build Command:"C:/PROGRA~1/ninja/ninja.exe" "cmTC_2cb9d" >> >> [1/2] Building C object CMakeFiles\cmTC_2cb9d.dir\testCCompiler.c.obj >> >> FAILED: D:\-Work-\LLVM-3~2.SRC\-VS_BU~2\Release\bin\clang.exe /DWIN32 >> /D_WINDOWS /W3 -o CMakeFiles\cmTC_2cb9d.dir\testCCompiler.c.obj -c >> testCCompiler.c >> >> clang.exe: error: no such file or directory: '/DWIN32' >> clang.exe: error: no such file or directory: '/D_WINDOWS' >> ... >> >> OS: Windows 7 (x64) >> >> clang version 3.7.1 (tags/RELEASE_371/final) >> Target: x86_64-pc-windows-msvc >> Thread model: posix >> >> cmake version 3.5.0-rc3 >> >> Thank you! >> >> -- >> Anton >> >> -- >> >> 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 >> > > > -- > Anton > >
-- 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