Installing Clang for QDoc | QDoc Manual 6.5.1

- Qt 6.5
- QDoc Manual
- Installing Clang for QDoc
- Qt 6.5.1 Reference Documentation

Getting Started with QDoc ◦ Creating QDoc Configuration Files

# Installing Clang for QDoc

QDoc uses Clang when parsing C++ files as well as function signatures in \fn commands. Clang is part of the LLVM Compiler Infrastructure Project. If you're going to build QDoc from source, you must install Clang 8.0 or later.

You can get Clang through various channels:

- Qt provides the prebuilt Clang packages that are used for the Qt binaries in the online installer. These let you link LLVM/Clang libraries statically, but only support Release builds on Windows.
- Linux distributions often provide a package called libclang-dev or libclang-devel. Qt's build system instructs CMake to look for ClangConfig.cmake, so make sure you install the package that provides this file if you want to build QDoc. Running QDoc requires only libclang.
- On macOS, you can also use Homebrew's llvm formula.

Note: the prebuilt binaries from http://releases.llvm.org/download.html cannot be used, as they miss certain components required by QDoc.

If you install Clang in a custom location you need to tell CMake where to find it. This can be done by adding the installation path to the `CMAKE_PREFIX_PATH` CMake cache variable.

Getting Started with QDoc ◦ Creating QDoc Configuration Files