-
Book Overview & Buying
-
Table Of Contents
LLVM Techniques, Tips, and Best Practices Clang and Middle-End Libraries
By :
In Chapter 1, Saving Resources When Building LLVM, we showed you how to build LLVM. Those instructions, however, did not build Clang. To include Clang in the build list, please edit the value that's been assigned to the LLVM_ENABLE_PROJECTS CMake variable, like so:
$ cmake -G Ninja -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra" …
The value of that variable should be a semi-colon-separated list, where each item is one of LLVM's subprojects. In this case, we're including Clang and clang-tools-extra, which contains a bunch of useful tools based on Clang's techniques. For example, the clang-format tool is used by countless open source projects, especially large-scale ones, to impose a unified coding style in their code base.
Adding Clang to an existing build
If you already have an LLVM build where Clang was not enabled, you can edit the LLVM_ENABLE_PROJECTS CMake argument's value in CMakeCache.txt without invoking...