Skip to content

Instantly share code, notes, and snippets.

@maikeulb
Forked from sleepdefic1t/MACOS_CLANG_TIDY.md
Created February 26, 2022 21:17
Show Gist options
  • Save maikeulb/ceabefeadd1feaddb869a25bb3bcd75e to your computer and use it in GitHub Desktop.
Save maikeulb/ceabefeadd1feaddb869a25bb3bcd75e to your computer and use it in GitHub Desktop.
brew clang-tidy on macOS
brew install llvm
ln -s "/usr/local/opt/llvm/bin/clang-format" "/usr/local/bin/clang-format"
ln -s "/usr/local/opt/llvm/bin/clang-tidy" "/usr/local/bin/clang-tidy"

use cmake file

  find_program(CLANG_TIDY_BIN clang-tidy)
  find_program(RUN_CLANG_TIDY_BIN /usr/local/Cellar/llvm/10.0.0_3/share/clang/run-clang-tidy.py)
    list(APPEND RUN_CLANG_TIDY_BIN_ARGS
         -clang-tidy-binary ${CLANG_TIDY_BIN}
         -header-filter="\".*\\b(cpp-client/src)\""
         -checks=clan*,cert*,misc*,perf*,cppc*,read*,mode*,-cert-err58-cpp,-misc-noexcept-move-constructor,-cppcoreguidelines-*)

    add_custom_target(tidy
                      COMMAND ${RUN_CLANG_TIDY_BIN} ${RUN_CLANG_TIDY_BIN_ARGS}
                      COMMENT "running clang tidy")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment