diff --git a/BifCl.cmake b/BifCl.cmake index 2519321..caf1eee 100644 --- a/BifCl.cmake +++ b/BifCl.cmake @@ -41,9 +41,6 @@ macro (bif_target bifInput) file(APPEND "${CMAKE_BINARY_DIR}/scripts/base/bif/__load__.zeek" "@load ./${bifInputBasename}.zeek\n") - # Do this here so that all of the necessary files for each individual BIF get added to clang-tidy - add_clang_tidy_files(${CMAKE_CURRENT_BINARY_DIR}/${bifInputBasename}.func_def) - elseif ("${ARGV1}" STREQUAL "plugin") set(plugin_name ${ARGV2}) set(plugin_name_canon ${ARGV3}) @@ -69,11 +66,6 @@ macro (bif_target bifInput) ${CMAKE_CURRENT_BINARY_DIR}/${bifInputBasename}.register.cc) endif () - # Do this here so that all of the necessary files for each individual BIF get added to clang-tidy - foreach (bif_cc_file ${BIF_OUTPUT_CC}) - add_clang_tidy_files(${CMAKE_CURRENT_BINARY_DIR}/${bif_cc_file}) - endforeach (bif_cc_file) - set(BIF_OUTPUT_H ${CMAKE_CURRENT_BINARY_DIR}/${bifInputBasename}.h) if (NOT ZEEK_PLUGIN_BUILD_DYNAMIC) @@ -95,11 +87,6 @@ macro (bif_target bifInput) set(BIF_OUTPUT_CC ${bifInputBasename}.cc) set(BIF_OUTPUT_H ${bifInputBasename}.h) - # Do this here so that all of the necessary files for each individual BIF get added to clang-tidy - foreach (bif_cc_file ${BIF_OUTPUT_CC}) - add_clang_tidy_files(${CMAKE_CURRENT_BINARY_DIR}/${bif_cc_file}) - endforeach (bif_cc_file) - # In order be able to run Zeek from the build directory, the # generated Zeek script needs to be inside a directory tree # named the same way it will be referenced from an @load. diff --git a/BinPAC.cmake b/BinPAC.cmake index e49ed90..22c209f 100644 --- a/BinPAC.cmake +++ b/BinPAC.cmake @@ -51,8 +51,6 @@ function (binpac_target pacFile) "-Wno-tautological-compare") endif () - add_clang_tidy_files(${CMAKE_CURRENT_BINARY_DIR}/${basename}_pac.cc) - set(target "pac-${CMAKE_CURRENT_BINARY_DIR}/${pacFile}") # Make sure to escape a bunch of special characters in the path before trying to use it as a diff --git a/FindClangTidy.cmake b/FindClangTidy.cmake deleted file mode 100644 index d994f96..0000000 --- a/FindClangTidy.cmake +++ /dev/null @@ -1,58 +0,0 @@ -# Common functions to use clang-tidy. This requires you to have clang-tidy in your path. If you also -# have run-clang-tidy.py in your path, it will attempt to use that to run clang-tidy in parallel. - -######################################################################## -# If this hasn't been initialized yet, find the program and then create a global property -# to store the list of sources in. -if (NOT CLANG_TIDY) - find_program(CLANG_TIDY NAMES clang-tidy) - find_program(RUN_CLANG_TIDY NAMES run-clang-tidy) - - if (NOT RUN_CLANG_TIDY) - find_program(RUN_CLANG_TIDY NAMES run-clang-tidy.py) - endif () - - if (CLANG_TIDY) - define_property( - GLOBAL - PROPERTY TIDY_SRCS - BRIEF_DOCS "Global list of sources for clang-tidy" - FULL_DOCS "Global list of sources for clang-tidy") - set_property(GLOBAL PROPERTY TIDY_SRCS "") - endif () -endif () - -######################################################################## -# Adds a list of files to the global list of files that will be checked. -function (add_clang_tidy_files) - if (CLANG_TIDY) - foreach (f ${ARGV}) - if (IS_ABSOLUTE ${f}) - set_property(GLOBAL APPEND PROPERTY TIDY_SRCS "${f}") - else () - set_property(GLOBAL APPEND PROPERTY TIDY_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/${f}") - endif () - endforeach (f) - endif () -endfunction () - -######################################################################## -# Creates the final target using the global list of files. -function (create_clang_tidy_target) - if (CLANG_TIDY) - get_property(final_tidy_srcs GLOBAL PROPERTY TIDY_SRCS) - list(REMOVE_DUPLICATES final_tidy_srcs) - - if (RUN_CLANG_TIDY) - add_custom_target( - clang-tidy - COMMAND ${RUN_CLANG_TIDY} -p ${PROJECT_BINARY_DIR} -clang-tidy-binary ${CLANG_TIDY} - -j 4 -export-fixes ${PROJECT_BINARY_DIR}/clang-tidy.yaml ${final_tidy_srcs} - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) - else () - add_custom_target( - clang-tidy COMMAND ${CLANG_TIDY} -p ${PROJECT_BINARY_DIR} ${final_tidy_srcs} - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) - endif () - endif () -endfunction () diff --git a/ZeekPluginDynamic.cmake b/ZeekPluginDynamic.cmake index 9584124..98f93ad 100644 --- a/ZeekPluginDynamic.cmake +++ b/ZeekPluginDynamic.cmake @@ -1,4 +1,3 @@ -include(FindClangTidy) include(GetArchitecture) # Sets `target` to contain the CMake target name for a dynamic plugin. diff --git a/ZeekPluginStatic.cmake b/ZeekPluginStatic.cmake index 15657d9..086777a 100644 --- a/ZeekPluginStatic.cmake +++ b/ZeekPluginStatic.cmake @@ -1,6 +1,5 @@ include(BifCl) include(BinPAC) -include(FindClangTidy) # Sets `target` to contain the CMake target name for a static plugin. macro (zeek_get_static_plugin_target target ns name) @@ -87,7 +86,6 @@ function (zeek_add_static_plugin ns name) # Add the sources for the plugin. if (FN_ARGS_SOURCES) target_sources(${target_name} PRIVATE ${FN_ARGS_SOURCES}) - add_clang_tidy_files(${FN_ARGS_SOURCES}) endif () # Setup for the load/preload scripts. @@ -124,6 +122,8 @@ function (zeek_add_static_plugin ns name) # Feed into the main Zeek target(s). zeek_target_link_libraries(${target_name}) - # Add IWYU and clang-tidy to the target if enabled. - zeek_target_add_linters(${target_name}) + if (NOT ZEEK_BUILDING_EXTRA_PLUGINS) + # Add IWYU and clang-tidy to the target if enabled. + zeek_target_add_linters(${target_name}) + endif () endfunction () diff --git a/ZeekSubdir.cmake b/ZeekSubdir.cmake index 93003e1..905b2e5 100644 --- a/ZeekSubdir.cmake +++ b/ZeekSubdir.cmake @@ -5,5 +5,4 @@ function (bro_add_subdir_library name) set(bro_SUBDIR_LIBS "$" ${bro_SUBDIR_LIBS} CACHE INTERNAL "subdir libraries") set(bro_SUBDIR_DEPS "bro_${name}" ${bro_SUBDIR_DEPS} CACHE INTERNAL "subdir dependencies") - add_clang_tidy_files(${ARGN}) endfunction ()