additional arguments with CMAKE_CXX_CLANG_TIDY variable

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

additional arguments with CMAKE_CXX_CLANG_TIDY variable

Michael Ellery
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



--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: additional arguments with CMAKE_CXX_CLANG_TIDY variable

Bill Hoffman
On 11/8/2016 11:20 AM, Michael Ellery wrote:
> /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/.....
That should still work.  It is passing that to -E __run_iwyu which
should expand the arguments.

https://gitlab.kitware.com/cmake/cmake/blob/master/Source/cmcmd.cxx#L353
cmSystemTools::ExpandListArgument will separate out the arguments.  My
guess is the * might be causing the trouble somehow.

-Bill


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: additional arguments with CMAKE_CXX_CLANG_TIDY variable

Michael Ellery

> On Nov 8, 2016, at 10:06 AM, Bill Hoffman <[hidden email]> wrote:
>
> On 11/8/2016 11:20 AM, Michael Ellery wrote:
>> /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/.....
> That should still work.  It is passing that to -E __run_iwyu which should expand the arguments.
>
> https://gitlab.kitware.com/cmake/cmake/blob/master/Source/cmcmd.cxx#L353
> cmSystemTools::ExpandListArgument will separate out the arguments.  My guess is the * might be causing the trouble somehow.
>
> -Bill
>
>

Thanks - a quick test using `checks=google-runtime-memset`  (for example) does NOT fail, so your speculation about * causing issues seems pretty likely. I’m not sure if this is a bug or if there is some other workaround for special arg characters...

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake