From b42e726a8e6f84d604df19b61c707211ae38e09b Mon Sep 17 00:00:00 2001 From: Tim Wojtulewicz Date: Tue, 6 Aug 2019 11:51:32 -0700 Subject: [PATCH] Use FindClangTidy in the cmake submodule to make things easier --- CMakeLists.txt | 1 + cmake | 2 +- src/CMakeLists.txt | 23 +++++++++-------------- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 91d6e4220d..84009f10f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,7 @@ project(Zeek C CXX) cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) include(cmake/CommonCMakeConfig.cmake) +include(cmake/FindClangTidy.cmake) ######################################################################## ## Project/Build Configuration diff --git a/cmake b/cmake index 58e4eebe3a..cbfc46f108 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit 58e4eebe3aebd0cf608e51046805a9ab1ffa6c1b +Subproject commit cbfc46f108cd3dcf29b6c6835f072a950e36cec3 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3a48407361..bc362c6d62 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -444,17 +444,12 @@ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/sqlite3.h DESTINATION include/zeek/3rdparty ) -find_program(CLANG_TIDY NAMES clang-tidy) -if (CLANG_TIDY) - set(TIDY_SRCS "") - foreach(f ${MAIN_SRCS}) - list(APPEND TIDY_SRCS "src/${f}") - endforeach(f) - # TODO: this currently doesn't include many of the subdirectories/plugins - # that build static libraries for inclusion into the final zeek binary - # (analyzers, broker, etc.) or generated code (BIFs, BinPAC, etc.). - add_custom_target(clang-tidy - COMMAND ${CLANG_TIDY} -p ${CMAKE_BINARY_DIR} ${TIDY_SRCS} - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - ) -endif() +######################################################################## +## Clang-tidy target now that we have all of the sources + +add_clang_tidy_files(${MAIN_SRCS}) + +# At this point we have included all of the cc files in src, all of the BinPAC +# (*.pac.cc) files, and most of the generated code for BIFs (not including +# *.bif.register.cc) +create_clang_tidy_target()