[cfe-dev] Building clang on Windows with CMake/Ninja

Óscar Fuentes ofv at wanadoo.es
Thu Nov 14 10:57:29 PST 2013


Edward Diener <eldlistmailingz at tropicsoft.com>
writes:

> On the clang getting started page there is:
>
> "It is also possible to use CMake instead of the makefiles. With CMake
> it is possible to generate project files for several IDEs: Xcode,
> Eclipse CDT4, CodeBlocks, Qt-Creator (use the CodeBlocks generator),
> KDevelop3."
>
> How does one build clang on Windows using MingW with CMake/Ninja ?

Install recent versions of MinGW, CMake and Ninja. Make sure everything
is reachable through PATH environment variable.

Let's suppose that LLVM sources are installed in C:\LLVM and Clang in
C:\LLVM\tools\clang

Execute this commands on a Windows command prompt and you are done:


mkdir \buildLLVM

cd \buildLLVM

cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=c:/llvm_installed ../llvm

ninja

ninja install


Be sure that ../llvm is indeed the path to the LLVM sources from the
build directory.

You can change CMAKE_BUILD_TYPE to Debug, depending on your usage. Last
time I tried (long time ago) it was not strictly required to install
Clang to use it.

More information about CMake & LLVM usage on
http://www.llvm.org/docs/CMake.html




More information about the cfe-dev mailing list