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. Therefore, if you are going to build QDoc from source, you need to install LLVM 8.0 or greater first.

You can get Clang through various channels:

  • Qt provides prebuilt Clang packages that are also used for the Qt binaries in the online installer. They allow to link LLVM/clang libraries statically, but only support Release builds on Windows.
  • Linux distributions often provide a package called libclang-dev or libclang-devel.
  • On macOS, you can also use Homebrew's llvm formula.

Note: the prebuilt binaries from 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.

© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.