How to specify additional arguments for use with the CMAKE_CXX_CLANG_TIDY variable

I am trying to use clang-tidy integration with cmake and I would like to pass an argument -check. I tried adding -DCMAKE_CXX_CLANG_TIDY="/usr/local/opt/llvm38/bin/clang-tidy-3.8;-checks=*"cmake when invoking, but my makefile commands look like this:

/usr/local/Cellar/cmake/3.6.2/bin/cmake -E __run_iwyu --tidy="/usr/local/opt/llvm38/bin/clang-tidy-3.8;-checks=*" --source=/Users/ellery/work/.....

In other words, it is like; separated arguments are not parsed separately. I also tried setting the target property CXX_CLANG_TIDYdirectly to my target with the same value, and I get the same behavior.

Has anyone successfully called clang-tidywith additional arguments via cmake?

+4
source share
2 answers

, , cmake 3.7.2 clang-tidy 4.0.

. :

cmake -DCMAKE_CXX_CLANG_TIDY="clang-tidy;-style=file;-checks=*"

CMakeLists.txt:

set(CMAKE_CXX_CLANG_TIDY "clang-tidy;-style=file;-checks=*")

, clang-tidy , , , .

+2

. CMake make , make . , clang-tidy .

CMAKE_CXX_CLANG_TIDY CMakeLists.txt:
set(CMAKE_CXX_CLANG_TIDY "clang-tidy" "-checks=*")

0

Source: https://habr.com/ru/post/1659884/


All Articles