Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ CheckOptions:
- key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
value: true
WarningsAsErrors: ''
HeaderFilterRegex: '.*'
HeaderFilterRegex: '^(?!.*_deps).*'
FormatStyle: file
11 changes: 8 additions & 3 deletions cmake/modules/FindClangTidy.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#
include_guard(GLOBAL)

option(CLANG_TIDY_ENABLE "Build with support for Include What You Use" OFF)
option(CLANG_TIDY_ENABLE "Build with support for clang-tidy" OFF)

set(ClangTidy_VERBOSITY_LEVEL 3 CACHE STRING "Clang Tidy verbosity level (the higher the level, the more output)")

Expand Down Expand Up @@ -134,18 +134,23 @@ function(enable_clang_tidy)
return()
endif()

if(NOT ClangTidy_FOUND)
_clang_tidy_log("clang-tidy not found")
return()
endif()

if(CLANG_TIDY_ARGS_CONFIG_FILE)
if(NOT EXISTS ${CLANG_TIDY_ARGS_CONFIG_FILE})
message(FATAL_ERROR "clang-tidy: Config file '${CLANG_TIDY_ARGS_CONFIG_FILE}' does not exist")
endif()
_clang_tidy_args_append("--config-file=${CLANG_TIDY_ARGS_CONFIG_FILE}")
endif()

set(CMAKE_CXX_CLANG_TIDY "${ClangTidy_EXECUTABLE};-p=${CMAKE_BINARY_DIR};${_clang_tidy_args}" PARENT_SCOPE)
set(XYZ_CLANG_TIDY "${ClangTidy_EXECUTABLE};-p=${CMAKE_BINARY_DIR};${_clang_tidy_args}" CACHE INTERNAL "clang-tidy command")

_clang_tidy_log(" Arguments: ${_clang_tidy_args}")
_clang_tidy_log("Enabling clang-tidy - done")
_clang_tidy_log("CLANG_TIDY = ${CMAKE_CXX_CLANG_TIDY}")
_clang_tidy_log("XYZ_CLANG_TIDY = ${XYZ_CLANG_TIDY}")
endfunction()

if (CLANG_TIDY_ENABLE)
Expand Down
4 changes: 4 additions & 0 deletions cmake/xyz_add_object_library.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,8 @@ function(xyz_add_object_library)
target_compile_definitions(${XYZ_NAME} PRIVATE ${XYZ_DEFINITIONS})
endif(XYZ_DEFINITIONS)

if(CLANG_TIDY_ENABLE AND ClangTidy_FOUND)
set_target_properties(${XYZ_NAME} PROPERTIES CXX_CLANG_TIDY "${XYZ_CLANG_TIDY}")
endif()

endfunction()
4 changes: 4 additions & 0 deletions cmake/xyz_add_test.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,8 @@ function(xyz_add_test)
add_coverage(${XYZ_NAME})
endif()

if(CLANG_TIDY_ENABLE AND ClangTidy_FOUND)
set_target_properties(${XYZ_NAME} PROPERTIES CXX_CLANG_TIDY "${XYZ_CLANG_TIDY}")
endif()

endfunction()
Loading