On Wed, Apr 20, 2016 at 5:54 PM, Brad King <brad.k...@kitware.com> wrote:
> On 04/20/2016 10:01 AM, Johan Holmberg wrote: > > I tried specifying "-GNinja" to cmake, and setting CC/CXX to > > clang/clang++. > > Good. > > > But this didn't work. I get errors like: > > > > clang.exe: error: no such file or directory: '/nologo' > > > > indicating that CMake thinks it should pass Visual C++ style > > options to clang. > > There are multiple variants of Clang that behave like "gcc" or "cl". > Which one is this? What installer did you use for Clang? > I used the installer at http://llvm.org/releases/3.8.0/LLVM-3.8.0-win64.exe . I chose the binaries behaving like "gcc": After installation I added the "bin" directory to my PATH (actual command "set path=e:\work\install\LLVM\bin;%PATH%"). In the new bin-directory there are binaries called "clang.exe" and "clang++.exe" + a bunch of other binaries eg. "clang-cl.exe". I did NOT put the directory "e:\work\install\LLVM\msbuild-bin" in my PATH (containing a binary "cl.exe"). I realize that Cristian Adams recommended using the "cl.exe" wrapper in his response, but I wanted at least to try using the "gcc-like" binaries first, hoping that they should work with CMake. I will probably try his advice later, but as I understand it, both ways should be possible to get working with CMake. > CMake should start out by printing the compiler id for the C and > CXX compilers. What did it show? > > CMake starts by saying: E:\work\proj\hello1\build> cmake -GNinja ..\src -- The C compiler identification is Clang 3.8.0 -- The CXX compiler identification is Clang 3.8.0 -- Check for working C compiler using: Ninja -- Check for working C compiler using: Ninja -- broken [...rest removed...] Please try a minimum test project like > > >type CMakeLists.txt > cmake_minimum_required(VERSION 3.5) > project(Test) > > in a fresh build tree and post the files > > CMakeFiles/CMake*.log > CMakeFiles/*/CMake*Compiler.cmake > > to see what CMake detected about the compiler. > Thanks, > -Brad > > OK, I attach the files to this mail. There were three file created: build/CMakeFiles/3.5.1/CMakeRCCompiler.cmake build/CMakeFiles/CMakeError.log build/CMakeFiles/CMakeOutput.log On my Windows machine I have Visual Studio 2008, 2012, 2013 and 2015. I used CMake 3.5.1 and Ninja 1.6.0. /Johan Holmberg
The system is: Windows - 6.1.7601 - AMD64 Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded. Compiler: E:/work/install/LLVM/bin/clang.exe Build flags: Id flags: The output was: 0 Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "a.exe" The C compiler identification is Clang, found in "E:/work/proj/hello1/build/CMakeFiles/3.5.1/CompilerIdC/a.exe" Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded. Compiler: E:/work/install/LLVM/bin/clang++.exe Build flags: Id flags: The output was: 0 Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "a.exe" The CXX compiler identification is Clang, found in "E:/work/proj/hello1/build/CMakeFiles/3.5.1/CompilerIdCXX/a.exe"
Determining if the C compiler works failed with the following output: Change Dir: E:/work/proj/hello1/build/CMakeFiles/CMakeTmp Run Build Command:"C:/Users/holmberg/home/bin/ninja.exe" "cmTC_98675" [1/2] Building C object CMakeFiles\cmTC_98675.dir\testCCompiler.c.obj FAILED: E:\work\install\LLVM\bin\clang.exe /nologo /DWIN32 /D_WINDOWS /W3 /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1 /showIncludes /FoCMakeFiles\cmTC_98675.dir\testCCompiler.c.obj /FdCMakeFiles\cmTC_98675.dir\ -c testCCompiler.c clang.exe: error: no such file or directory: '/nologo' clang.exe: error: no such file or directory: '/DWIN32' clang.exe: error: no such file or directory: '/D_WINDOWS' clang.exe: error: no such file or directory: '/W3' clang.exe: error: no such file or directory: '/D_DEBUG' clang.exe: error: no such file or directory: '/MDd' clang.exe: error: no such file or directory: '/Zi' clang.exe: error: no such file or directory: '/Ob0' clang.exe: error: no such file or directory: '/Od' clang.exe: error: no such file or directory: '/RTC1' clang.exe: error: no such file or directory: '/showIncludes' clang.exe: error: no such file or directory: '/FoCMakeFiles\cmTC_98675.dir\testCCompiler.c.obj' clang.exe: error: no such file or directory: '/FdCMakeFiles\cmTC_98675.dir\' ninja: build stopped: subcommand failed.
set(CMAKE_RC_COMPILER "rc") set(CMAKE_RC_COMPILER_ARG1 "") set(CMAKE_RC_COMPILER_LOADED 1) set(CMAKE_RC_SOURCE_FILE_EXTENSIONS rc;RC) set(CMAKE_RC_OUTPUT_EXTENSION .res) set(CMAKE_RC_COMPILER_ENV_VAR "RC")
-- 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