[CMake] Question on usage of cmake on Windows with clang

Cristian Adam cristian.adam at gmail.com
Mon Feb 8 08:06:22 EST 2016


On Mon, Feb 8, 2016 at 1:56 PM, Victor Leschuk <vleschuk at gmail.com> wrote:

> Hello, I am trying to use clang with cmake on Windows.
>
> I have compiled LLVM+clang using Visual Studio 2015. And now I am facing
> problems with building cmake projects using this clang. It looks like cmake
> is trying to pass wrong options to linker.
>
> os: Windows 7 (64bit)
>
> $ clang --version
> clang version 3.9.0
> Target: i686-pc-windows-msvc
> Thread model: posix
>
> $ cmake --version
> cmake version 3.5.0-rc1
>
> It would be great if someone could point me to what am I doing wrong?
>
> Thanks in advance!
>

Did you build also libc++? Which CRT does clang 3.9.0 use on Windows?

Clang officially offers the clang-cl driver, which is a Visual C++ cl.exe
replacement.

The following works with Clang 3.7.0 and Visual C++ 2013 (should also work
with Clang 3.9 and Visual C++ 2015):

1. Open Visual C++ command prompt window
2. Set INCLUDE and PATH to the clang-cl
    set PATH=C:\Program Files (x86)\LLVM\msbuild-bin\;%PATH%
    set INCLUDE=C:\Program Files
(x86)\LLVM\lib\clang\3.7.0\include\;%INCLUDE%
3. cmake -G "Ninja" will pick clang-cl and should build and link just fine.

HTH,
Cristian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160208/26e3a0ce/attachment.html>


More information about the CMake mailing list