Use FindClangTidy in the cmake submodule to make things easier

This commit is contained in:
Tim Wojtulewicz 2019-08-06 11:51:32 -07:00
parent 31d30bb47e
commit b42e726a8e
3 changed files with 11 additions and 15 deletions

View file

@ -5,6 +5,7 @@ project(Zeek C CXX)
cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
include(cmake/CommonCMakeConfig.cmake) include(cmake/CommonCMakeConfig.cmake)
include(cmake/FindClangTidy.cmake)
######################################################################## ########################################################################
## Project/Build Configuration ## Project/Build Configuration

2
cmake

@ -1 +1 @@
Subproject commit 58e4eebe3aebd0cf608e51046805a9ab1ffa6c1b Subproject commit cbfc46f108cd3dcf29b6c6835f072a950e36cec3

View file

@ -444,17 +444,12 @@ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/sqlite3.h
DESTINATION include/zeek/3rdparty DESTINATION include/zeek/3rdparty
) )
find_program(CLANG_TIDY NAMES clang-tidy) ########################################################################
if (CLANG_TIDY) ## Clang-tidy target now that we have all of the sources
set(TIDY_SRCS "")
foreach(f ${MAIN_SRCS}) add_clang_tidy_files(${MAIN_SRCS})
list(APPEND TIDY_SRCS "src/${f}")
endforeach(f) # At this point we have included all of the cc files in src, all of the BinPAC
# TODO: this currently doesn't include many of the subdirectories/plugins # (*.pac.cc) files, and most of the generated code for BIFs (not including
# that build static libraries for inclusion into the final zeek binary # *.bif.register.cc)
# (analyzers, broker, etc.) or generated code (BIFs, BinPAC, etc.). create_clang_tidy_target()
add_custom_target(clang-tidy
COMMAND ${CLANG_TIDY} -p ${CMAKE_BINARY_DIR} ${TIDY_SRCS}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
endif()