mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-28 18:09:42 -05:00
clang-tidy: add option CMake_RUN_CLANG_TIDY
This commit is contained in:
+30
@@ -0,0 +1,30 @@
|
|||||||
|
---
|
||||||
|
Checks: "-*,\
|
||||||
|
misc-*,\
|
||||||
|
-misc-incorrect-roundings,\
|
||||||
|
-misc-macro-parentheses,\
|
||||||
|
-misc-misplaced-widening-cast,\
|
||||||
|
-misc-static-assert,\
|
||||||
|
modernize-make-shared,\
|
||||||
|
modernize-make-unique,\
|
||||||
|
modernize-redundant-void-arg,\
|
||||||
|
modernize-use-bool-literals,\
|
||||||
|
modernize-use-nullptr,\
|
||||||
|
modernize-use-override,\
|
||||||
|
performance-*,\
|
||||||
|
-performance-inefficient-string-concatenation,\
|
||||||
|
readability-*,\
|
||||||
|
-readability-function-size,\
|
||||||
|
-readability-identifier-naming,\
|
||||||
|
-readability-implicit-bool-cast,\
|
||||||
|
-readability-inconsistent-declaration-parameter-name,\
|
||||||
|
-readability-named-parameter,\
|
||||||
|
-readability-redundant-declaration,\
|
||||||
|
-readability-redundant-member-init,\
|
||||||
|
-readability-simplify-boolean-expr,\
|
||||||
|
"
|
||||||
|
HeaderFilterRegex: 'Source/cm[^/]*\.(h|hxx|cxx)$'
|
||||||
|
CheckOptions:
|
||||||
|
- key: modernize-use-nullptr.NullMacros
|
||||||
|
value: 'CM_NULLPTR'
|
||||||
|
...
|
||||||
@@ -226,6 +226,20 @@ option(CMAKE_USE_FOLDERS "Enable folder grouping of projects in IDEs." ON)
|
|||||||
mark_as_advanced(CMAKE_USE_FOLDERS)
|
mark_as_advanced(CMAKE_USE_FOLDERS)
|
||||||
|
|
||||||
|
|
||||||
|
option(CMake_RUN_CLANG_TIDY "Run clang-tidy with the compiler." OFF)
|
||||||
|
if(CMake_RUN_CLANG_TIDY)
|
||||||
|
if(CMake_SOURCE_DIR STREQUAL CMake_BINARY_DIR)
|
||||||
|
message(FATAL_ERROR "CMake_RUN_CLANG_TIDY requires an out-of-source build!")
|
||||||
|
endif()
|
||||||
|
find_program(CLANG_TIDY_COMMAND NAMES clang-tidy)
|
||||||
|
if(NOT CLANG_TIDY_COMMAND)
|
||||||
|
message(FATAL_ERROR "CMake_RUN_CLANG_TIDY is ON but clang-tidy is not found!")
|
||||||
|
endif()
|
||||||
|
set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_COMMAND}")
|
||||||
|
endif()
|
||||||
|
configure_file(.clang-tidy .clang-tidy COPYONLY)
|
||||||
|
|
||||||
|
|
||||||
option(CMake_RUN_IWYU "Run include-what-you-use with the compiler." OFF)
|
option(CMake_RUN_IWYU "Run include-what-you-use with the compiler." OFF)
|
||||||
if(CMake_RUN_IWYU)
|
if(CMake_RUN_IWYU)
|
||||||
find_program(IWYU_COMMAND NAMES include-what-you-use iwyu)
|
find_program(IWYU_COMMAND NAMES include-what-you-use iwyu)
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
# We want to disable all checks for 3rd party code. However, clang-tidy will
|
||||||
|
# assume we did not configure it correctly. Just add one check that will never
|
||||||
|
# be found.
|
||||||
|
Checks: '-*,llvm-twine-local'
|
||||||
|
...
|
||||||
@@ -29,3 +29,6 @@ endif()
|
|||||||
if(WIX_CUSTOM_ACTION_ENABLED)
|
if(WIX_CUSTOM_ACTION_ENABLED)
|
||||||
add_subdirectory(Release/WiX)
|
add_subdirectory(Release/WiX)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Make sure generated files use the same clang-tidy checks (none).
|
||||||
|
configure_file(.clang-tidy .clang-tidy COPYONLY)
|
||||||
|
|||||||
Reference in New Issue
Block a user