[CMake] Using Clang + Ninja on Windows?

Johan Holmberg johan556 at gmail.com
Wed Apr 20 10:01:02 EDT 2016


Hi!

How should I setup CMake to build a C/C++ application on Windows using
clang/clang++ as compilers and Ninja as build tool?

I tried specifying "-GNinja" to cmake, and setting CC/CXX to clang/clang++.
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.

I'm thinking about fooling CMake that clang/clang++ are cross compilers (I
know how to get cross compiling working in other cases). But since
clang/clang++ are the native tools for Windows, I was hoping to be able to
use Clang + Ninja on Windows almost like I use on Linux.

If I run Clang from the command line, I can build my application, so my
Clang-installation works.

I'm using CMake 3.5.1 and Clang 3.8.0.

/Johan Holmberg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160420/cb3d0cad/attachment-0001.html>


More information about the CMake mailing list