diff options
| author | manuel <manuel@mausz.at> | 2020-10-19 00:52:24 +0200 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2020-10-19 00:52:24 +0200 |
| commit | be933ef2241d79558f91796cc5b3a161f72ebf9c (patch) | |
| tree | fe3ab2f130e20c99001f2d7a81d610c78c96a3f4 /cmake/modules/FindClangTidy.cmake | |
| parent | 5f8335c1e49ce108ef3481863833c98efa00411b (diff) | |
| download | kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.tar.gz kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.tar.bz2 kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.zip | |
sync with upstream
Diffstat (limited to 'cmake/modules/FindClangTidy.cmake')
| -rw-r--r-- | cmake/modules/FindClangTidy.cmake | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/cmake/modules/FindClangTidy.cmake b/cmake/modules/FindClangTidy.cmake new file mode 100644 index 0000000..6ea614d --- /dev/null +++ b/cmake/modules/FindClangTidy.cmake | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | #.rst: | ||
| 2 | # FindClangTidy | ||
| 3 | # ------------- | ||
| 4 | # Finds clang-tidy and sets it up to run along with the compiler for C and CXX. | ||
| 5 | |||
| 6 | find_program(CLANG_TIDY_EXECUTABLE clang-tidy) | ||
| 7 | |||
| 8 | if(CLANG_TIDY_EXECUTABLE) | ||
| 9 | execute_process(COMMAND "${CLANG_TIDY_EXECUTABLE}" --version | ||
| 10 | OUTPUT_VARIABLE CLANG_TIDY_VERSION | ||
| 11 | OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
| 12 | string(REGEX MATCH "[^\n]* version [^\n]*" CLANG_TIDY_VERSION "${CLANG_TIDY_VERSION}") | ||
| 13 | string(REGEX REPLACE ".* version (.*)" "\\1" CLANG_TIDY_VERSION "${CLANG_TIDY_VERSION}") | ||
| 14 | endif() | ||
| 15 | |||
| 16 | include(FindPackageHandleStandardArgs) | ||
| 17 | find_package_handle_standard_args(ClangTidy REQUIRED_VARS CLANG_TIDY_EXECUTABLE | ||
| 18 | VERSION_VAR CLANG_TIDY_VERSION) | ||
| 19 | |||
| 20 | if(CLANGTIDY_FOUND) | ||
| 21 | # Supports Unix Makefiles and Ninja | ||
| 22 | set(CMAKE_C_CLANG_TIDY "${CLANG_TIDY_EXECUTABLE}" PARENT_SCOPE) | ||
| 23 | set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_EXECUTABLE}" PARENT_SCOPE) | ||
| 24 | endif() | ||
| 25 | |||
| 26 | mark_as_advanced(CLANG_TIDY_EXECUTABLE) | ||
