Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to build the latest clang-tidy?

Tags:

I've tried to build clang-tidy from sources but it complains about an undefined CMake command:

CMake Error at clang-apply-replacements/CMakeLists.txt:5 (add_clang_library):   Unknown CMake command "add_clang_library".   CMake Warning (dev) in CMakeLists.txt:   No cmake_minimum_required command is present.  A line of code such as      cmake_minimum_required(VERSION 3.9)    should be added at the top of the file.  The version specified may be lower   if you wish to support older CMake versions for this project.  For more   information run "cmake --help-policy CMP0000". This warning is for project developers.  Use -Wno-dev to suppress it.  -- Configuring incomplete, errors occurred! 

How can I build clang-tidy or, alternatively, how can I install the latest version on macOS?

like image 479
ruipacheco Avatar asked Nov 13 '17 00:11

ruipacheco


People also ask

Does clang tidy compile?

The most convenient way to run clang-tidy is with a compile command database; CMake can automatically generate one, for a description of how to enable it see How To Setup Tooling For LLVM.

How do I install the latest clang format?

You can install clang-format and git-clang-format via npm install -g clang-format . To automatically format a file according to Electron C++ code style, run clang-format -i path/to/electron/file.cc . It should work on macOS/Linux/Windows.

What is the latest version of clang format?

Clang 14, the latest major version of Clang as of March 2022, has full support for all published C++ standards up to C++17, implements most features of C++20, and has initial support for the upcoming C++23 standard.


1 Answers

Up-to-date steps:

git clone https://github.com/llvm/llvm-project.git cd llvm-project mkdir build  cd build cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLLVM_ENABLE_PROJECTS="clang-tools-extra" ../llvm make install clang-tidy 

Reference, ninja, and other details: my own blog post.

like image 146
YvesgereY Avatar answered Sep 25 '22 08:09

YvesgereY