[CMake] additional arguments with CMAKE_CXX_CLANG_TIDY variable

Michael Ellery mellery451 at gmail.com
Tue Nov 8 11:20:11 EST 2016


I asked this question on SO and am repeating here with the hope someone knows the answer:

http://stackoverflow.com/questions/40433573/how-can-i-specify-additional-arguments-for-use-with-cmake-cxx-clang-tidy-variabl

——
I'm trying to use make use of clang-tidy integration with cmake and I'd like to pass the -check argument. I've tried adding -DCMAKE_CXX_CLANG_TIDY="/usr/local/opt/llvm38/bin/clang-tidy-3.8;-checks=*" when invoking cmake, but my makefile commands end-up looking like:

/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 seems like the ; separated args are not being parsed apart. I've also tried setting the target property CXX_CLANG_TIDY directly on my target with the same value and I get the same behavior. If I remove ‘;checks=*’ from the string, everything works fine, but I get default clang-tidy behavior.

Has anyone succesfully invoked clang-tidy with additional args through cmake?
——

Thanks,
Mike Ellery





More information about the CMake mailing list