[CMake] Using Clang + Ninja on Windows?
Johan Holmberg
johan556 at gmail.com
Thu Apr 21 10:15:26 EDT 2016
On Wed, Apr 20, 2016 at 5:54 PM, Brad King <brad.king at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160421/735b72eb/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CMakeOutput.log
Type: text/x-log
Size: 847 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160421/735b72eb/attachment-0003.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CMakeError.log
Type: text/x-log
Size: 1342 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160421/735b72eb/attachment-0004.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CMakeRCCompiler.cmake
Type: text/x-cmake
Size: 212 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160421/735b72eb/attachment-0005.bin>
More information about the CMake
mailing list