From 84e3f414a75d3c06e7a6d70243a4794306cc71a2 Mon Sep 17 00:00:00 2001 From: Tim Wojtulewicz Date: Mon, 8 May 2023 10:19:26 -0700 Subject: [PATCH] Use the same rules as cmake submodule to reformat Zeek --- .cmake-format.json | 80 ++ .pre-commit-config.yaml | 6 + CMakeLists.txt | 984 +++++++++--------- man/CMakeLists.txt | 10 +- scripts/CMakeLists.txt | 30 +- src/CMakeLists.txt | 491 ++++----- src/analyzer/CMakeLists.txt | 14 +- .../protocol/bittorrent/CMakeLists.txt | 15 +- .../protocol/conn-size/CMakeLists.txt | 9 +- src/analyzer/protocol/dce-rpc/CMakeLists.txt | 23 +- src/analyzer/protocol/dhcp/CMakeLists.txt | 17 +- src/analyzer/protocol/dnp3/CMakeLists.txt | 15 +- src/analyzer/protocol/dns/CMakeLists.txt | 7 +- src/analyzer/protocol/file/CMakeLists.txt | 7 +- src/analyzer/protocol/finger/CMakeLists.txt | 9 +- .../protocol/finger/legacy/CMakeLists.txt | 7 +- src/analyzer/protocol/ftp/CMakeLists.txt | 9 +- src/analyzer/protocol/gnutella/CMakeLists.txt | 7 +- src/analyzer/protocol/gssapi/CMakeLists.txt | 15 +- src/analyzer/protocol/http/CMakeLists.txt | 9 +- src/analyzer/protocol/ident/CMakeLists.txt | 7 +- src/analyzer/protocol/imap/CMakeLists.txt | 13 +- src/analyzer/protocol/irc/CMakeLists.txt | 7 +- src/analyzer/protocol/krb/CMakeLists.txt | 43 +- src/analyzer/protocol/login/CMakeLists.txt | 17 +- src/analyzer/protocol/mime/CMakeLists.txt | 7 +- src/analyzer/protocol/modbus/CMakeLists.txt | 13 +- src/analyzer/protocol/mqtt/CMakeLists.txt | 41 +- src/analyzer/protocol/mysql/CMakeLists.txt | 13 +- src/analyzer/protocol/ncp/CMakeLists.txt | 11 +- src/analyzer/protocol/netbios/CMakeLists.txt | 9 +- src/analyzer/protocol/ntlm/CMakeLists.txt | 15 +- src/analyzer/protocol/ntp/CMakeLists.txt | 17 +- src/analyzer/protocol/pia/CMakeLists.txt | 8 +- src/analyzer/protocol/pop3/CMakeLists.txt | 7 +- src/analyzer/protocol/radius/CMakeLists.txt | 13 +- src/analyzer/protocol/rdp/CMakeLists.txt | 25 +- src/analyzer/protocol/rfb/CMakeLists.txt | 13 +- src/analyzer/protocol/rpc/CMakeLists.txt | 15 +- src/analyzer/protocol/sip/CMakeLists.txt | 21 +- src/analyzer/protocol/smb/CMakeLists.txt | 165 ++- src/analyzer/protocol/smtp/CMakeLists.txt | 9 +- src/analyzer/protocol/snmp/CMakeLists.txt | 17 +- src/analyzer/protocol/socks/CMakeLists.txt | 13 +- src/analyzer/protocol/ssh/CMakeLists.txt | 17 +- src/analyzer/protocol/ssl/CMakeLists.txt | 53 +- src/analyzer/protocol/syslog/CMakeLists.txt | 9 +- .../protocol/syslog/legacy/CMakeLists.txt | 13 +- src/analyzer/protocol/tcp/CMakeLists.txt | 17 +- src/analyzer/protocol/xmpp/CMakeLists.txt | 13 +- src/analyzer/protocol/zip/CMakeLists.txt | 8 +- src/broker/CMakeLists.txt | 19 +- src/file_analysis/CMakeLists.txt | 21 +- .../analyzer/data_event/CMakeLists.txt | 7 +- .../analyzer/entropy/CMakeLists.txt | 7 +- .../analyzer/extract/CMakeLists.txt | 9 +- .../analyzer/hash/CMakeLists.txt | 7 +- src/file_analysis/analyzer/pe/CMakeLists.txt | 19 +- .../analyzer/x509/CMakeLists.txt | 21 +- src/fuzzers/CMakeLists.txt | 83 +- src/input/CMakeLists.txt | 11 +- src/input/readers/CMakeLists.txt | 3 +- src/input/readers/ascii/CMakeLists.txt | 7 +- src/input/readers/benchmark/CMakeLists.txt | 7 +- src/input/readers/binary/CMakeLists.txt | 7 +- src/input/readers/config/CMakeLists.txt | 7 +- src/input/readers/raw/CMakeLists.txt | 7 +- src/input/readers/sqlite/CMakeLists.txt | 7 +- src/iosource/CMakeLists.txt | 13 +- src/iosource/pcap/CMakeLists.txt | 9 +- src/logging/CMakeLists.txt | 11 +- src/logging/writers/CMakeLists.txt | 3 +- src/logging/writers/ascii/CMakeLists.txt | 9 +- src/logging/writers/none/CMakeLists.txt | 7 +- src/logging/writers/sqlite/CMakeLists.txt | 7 +- src/packet_analysis/CMakeLists.txt | 13 +- .../protocol/arp/CMakeLists.txt | 7 +- .../protocol/ayiya/CMakeLists.txt | 8 +- .../protocol/ethernet/CMakeLists.txt | 8 +- .../protocol/fddi/CMakeLists.txt | 8 +- .../protocol/geneve/CMakeLists.txt | 7 +- .../protocol/gre/CMakeLists.txt | 8 +- .../protocol/gtpv1/CMakeLists.txt | 15 +- .../protocol/icmp/CMakeLists.txt | 9 +- .../protocol/ieee802_11/CMakeLists.txt | 8 +- .../protocol/ieee802_11_radio/CMakeLists.txt | 8 +- .../protocol/ip/CMakeLists.txt | 9 +- .../protocol/iptunnel/CMakeLists.txt | 8 +- .../protocol/linux_sll/CMakeLists.txt | 8 +- .../protocol/linux_sll2/CMakeLists.txt | 8 +- .../protocol/llc/CMakeLists.txt | 8 +- .../protocol/mpls/CMakeLists.txt | 8 +- .../protocol/nflog/CMakeLists.txt | 8 +- .../protocol/novell_802_3/CMakeLists.txt | 8 +- .../protocol/null/CMakeLists.txt | 8 +- .../protocol/pbb/CMakeLists.txt | 1 - .../protocol/ppp_serial/CMakeLists.txt | 8 +- .../protocol/pppoe/CMakeLists.txt | 8 +- .../protocol/root/CMakeLists.txt | 8 +- .../protocol/skip/CMakeLists.txt | 8 +- .../protocol/snap/CMakeLists.txt | 8 +- .../protocol/tcp/CMakeLists.txt | 9 +- .../protocol/teredo/CMakeLists.txt | 9 +- .../protocol/udp/CMakeLists.txt | 9 +- .../protocol/vlan/CMakeLists.txt | 8 +- .../protocol/vntag/CMakeLists.txt | 8 +- .../protocol/vxlan/CMakeLists.txt | 7 +- .../protocol/wrapper/CMakeLists.txt | 8 +- src/probabilistic/CMakeLists.txt | 19 +- src/session/CMakeLists.txt | 8 +- src/telemetry/CMakeLists.txt | 8 +- src/zeekygen/CMakeLists.txt | 19 +- testing/CMakeLists.txt | 10 +- .../CMakeLists.txt | 3 +- .../plugins/conflict-plugin/CMakeLists.txt | 3 +- .../btest/plugins/file-plugin/CMakeLists.txt | 3 +- .../packet-protocol-plugin/CMakeLists.txt | 3 +- .../plugins/pktdumper-plugin/CMakeLists.txt | 3 +- .../plugins/pktsrc-plugin/CMakeLists.txt | 3 +- .../plugins/protocol-plugin/CMakeLists.txt | 3 +- .../plugins/reader-plugin/CMakeLists.txt | 3 +- .../plugins/writer-plugin/CMakeLists.txt | 3 +- .../Files/protocol-plugin/CMakeLists.txt | 3 +- .../Files/py-lib-plugin/CMakeLists.txt | 4 +- .../Files/zeek-version-plugin/CMakeLists.txt | 3 +- 125 files changed, 1423 insertions(+), 1670 deletions(-) create mode 100644 .cmake-format.json diff --git a/.cmake-format.json b/.cmake-format.json new file mode 100644 index 0000000000..ff553dbbe2 --- /dev/null +++ b/.cmake-format.json @@ -0,0 +1,80 @@ +{ + "parse": { + "additional_commands": { + "CheckIPProto": { + "kwargs": { + "_proto": "*" + } + }, + "CheckType": { + "kwargs": { + "_type": "*", + "_alt_type": "*", + "_var": "*" + } + }, + "SetPackageVersion": { + "kwargs": { + "_version": "*" + } + }, + "SetPackageFileName": { + "kwargs": { + "_version": "*" + } + }, + "SetPackageInstallScripts": { + "kwargs": { + "VERSION": "*" + } + }, + "ConfigurePackaging": { + "kwargs": { + "_version": "*" + } + }, + "SetPackageGenerators": {}, + "SetPackageMetadata": {}, + "FindRequiredPackage": { + "kwargs": { + "packageName": "*" + } + }, + "InstallClobberImmune": { + "kwargs": { + "_srcfile": "*", + "_dstfile": "*" + } + }, + "InstallPackageConfigFile": { + "kwargs": { + "_srcfile": "*", + "_dstdir": "*", + "_dstfilename": "*" + } + }, + "InstallShellScript": { + "kwargs": { + "_srcfile": "*", + "_dstfile": "*" + } + }, + "InstallSymLink": { + "kwargs": { + "_filepath": "*", + "_sympath": "*" + } + } + } + }, + "format": { + "line_width": 100, + "tab_size": 4, + "separate_ctrl_name_with_space": true, + "max_subgroups_hwrap": 3, + "line_ending": "unix" + }, + "markup": { + "enable_markup": false + } +} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 50844cf58b..4315bdfbb9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,3 +17,9 @@ repos: rev: v0.31.0 hooks: - id: yapf + +- repo: https://github.com/cheshirekow/cmake-format-precommit + rev: v0.6.13 + hooks: + - id: cmake-format + exclude: '^auxil/.*$' diff --git a/CMakeLists.txt b/CMakeLists.txt index 43952dc00d..858fd31ddd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,30 +2,29 @@ # auxil/zeek-aux/plugin-support/skeleton/CMakeLists.txt cmake_minimum_required(VERSION 3.15.0 FATAL_ERROR) -if ( WIN32 ) +if (WIN32) # Enable usage of CMAKE_MSVC_RUNTIME_LIBRARY variable cmake_policy(SET CMP0091 NEW) -endif() +endif () project(Zeek C CXX) - # We want to set ENABLE_DEBUG to ON by default if the build type is Debug. set(ENABLE_DEBUG_DEFAULT OFF) -if ( NOT GENERATOR_IS_MULTI_CONFIG ) - string(TOLOWER "${CMAKE_BUILD_TYPE}" build_type_lower) - if ( build_type_lower STREQUAL "debug" ) - set(ENABLE_DEBUG_DEFAULT ON) - endif () - unset(build_type_lower) +if (NOT GENERATOR_IS_MULTI_CONFIG) + string(TOLOWER "${CMAKE_BUILD_TYPE}" build_type_lower) + if (build_type_lower STREQUAL "debug") + set(ENABLE_DEBUG_DEFAULT ON) + endif () + unset(build_type_lower) endif () # On UNIX, install additional Zeek tools by default and build shared objects. -if ( NOT WIN32 ) - set(ZEEK_INSTALL_TOOLS_DEFAULT ON) - option(BUILD_SHARED_LIBS "Build targets as shared libraries." ON) +if (NOT WIN32) + set(ZEEK_INSTALL_TOOLS_DEFAULT ON) + option(BUILD_SHARED_LIBS "Build targets as shared libraries." ON) else () - set(ZEEK_INSTALL_TOOLS_DEFAULT OFF) + set(ZEEK_INSTALL_TOOLS_DEFAULT OFF) endif () # CMake options (Boolean flags). @@ -44,8 +43,8 @@ option(PREALLOCATE_PORT_ARRAY "Pre-allocate all ports for zeek::Val." ON) option(ZEEK_STANDALONE "Build Zeek as stand-alone binary?" ON) # Non-boolean options. -if ( NOT WIN32 ) - if ( CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT ) +if (NOT WIN32) + if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "/usr/local/zeek" CACHE PATH "Install directory used by install()." FORCE) endif () @@ -59,8 +58,8 @@ set(ZEEK_SCRIPT_INSTALL_PATH "${CMAKE_INSTALL_PREFIX}/share/zeek" set(ZEEK_ETC_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/etc" CACHE PATH "Install directory for Zeek configuration files.") -set(CMAKE_EXPORT_COMPILE_COMMANDS ON - CACHE INTERNAL "Whether to write a JSON compile commands database") +set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE INTERNAL + "Whether to write a JSON compile commands database") set(ZEEK_CXX_STD cxx_std_17 CACHE STRING "The C++ standard to use.") @@ -75,7 +74,7 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR}) list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR}) # Windows: Configure runtime and dependencies -if ( MSVC ) +if (MSVC) # Remove existing runtime flags set(CompilerFlags CMAKE_CXX_FLAGS @@ -85,9 +84,8 @@ if ( MSVC ) CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE - CMAKE_C_FLAGS_RELWITHDEBINFO - ) - foreach(CompilerFlag ${CompilerFlags}) + CMAKE_C_FLAGS_RELWITHDEBINFO) + foreach (CompilerFlag ${CompilerFlags}) string(REGEX REPLACE "[/|-]MDd" "" ${CompilerFlag} "${${CompilerFlag}}") string(REGEX REPLACE "[/|-]MD" "" ${CompilerFlag} "${${CompilerFlag}}") string(REGEX REPLACE "[/|-]MTd" "" ${CompilerFlag} "${${CompilerFlag}}") @@ -95,15 +93,13 @@ if ( MSVC ) string(REGEX REPLACE "[/|-]Zi" "" ${CompilerFlag} "${${CompilerFlag}}") string(REGEX REPLACE "[/|-]W3" "" ${CompilerFlag} "${${CompilerFlag}}") string(REGEX REPLACE "[/|-]W4" "" ${CompilerFlag} "${${CompilerFlag}}") - endforeach() + endforeach () # Set compilation flags for Windows - add_compile_options( - /guard:cf # required by CheckCFlags - /Z7) # required by CheckCFlags + add_compile_options(/guard:cf # required by CheckCFlags + /Z7) # required by CheckCFlags - add_link_options( - /debug:full # required by CheckCFlags + add_link_options(/debug:full # required by CheckCFlags ) # Set always to static runtime @@ -120,22 +116,21 @@ if ( MSVC ) set(OPENSSL_USE_STATIC_LIBS true) set(OPENSSL_MSVC_STATIC_RT true) - if ( ZEEK_STANDALONE ) + if (ZEEK_STANDALONE) include(${CMAKE_SOURCE_DIR}/cmake/conan.cmake) conan_cmake_autodetect(settings) # Install packages from conanfile conan_cmake_install(PATH_OR_REFERENCE ${CMAKE_SOURCE_DIR}/ci/windows/conanfile_windows.txt - BUILD missing - SETTINGS ${settings}) - endif() + BUILD missing SETTINGS ${settings}) + endif () # Set LibPCAP to point to libpcap binaries. - if ( NOT PCAP_ROOT_DIR ) + if (NOT PCAP_ROOT_DIR) find_package(libpcap) set(PCAP_ROOT_DIR "${libpcap_LIB_DIRS}/../") set(PCAP_INCLUDE_DIR ${libpcap_INCLUDES}) set(PCAP_LIBRARY ${libpcap_LIBS}) - endif() + endif () set(LIBPCAP_PCAP_COMPILE_NOPCAP_HAS_ERROR_PARAMETER false) @@ -151,7 +146,8 @@ if ( MSVC ) add_definitions(-DCARES_STATICLIB) add_subdirectory(auxil/libunistd) - set(UNISTD_INCLUDES ${CMAKE_SOURCE_DIR}/auxil/libunistd/unistd ${CMAKE_SOURCE_DIR}/auxil/libunistd/regex) + set(UNISTD_INCLUDES ${CMAKE_SOURCE_DIR}/auxil/libunistd/unistd + ${CMAKE_SOURCE_DIR}/auxil/libunistd/regex) include_directories(BEFORE ${UNISTD_INCLUDES}) # Required for `check_include_files` to operate correctly list(APPEND CMAKE_REQUIRED_INCLUDES ${UNISTD_INCLUDES}) @@ -173,8 +169,8 @@ include(cmake/CommonCMakeConfig.cmake) include(cmake/FindClangTidy.cmake) include(cmake/CheckCompilerArch.cmake) -######################################################################## -## Main targets and utilities. +# ############################################################################## +# Main targets and utilities. # Variable for referring back to Zeek's top-level source dir. Used for plugins # to tell them where to find the Zeek headers. @@ -184,8 +180,8 @@ set(ZEEK_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") # zeek-plugin-create-package.sh. Needed by ZeekPluginConfig.cmake.in. set(ZEEK_PLUGIN_SCRIPTS_PATH "${PROJECT_SOURCE_DIR}/cmake") -# Our C++17 base target for propagating compiler and linker flags. -# Note: for now, we only use it for passing library dependencies around. +# Our C++17 base target for propagating compiler and linker flags. Note: for +# now, we only use it for passing library dependencies around. add_library(zeek_internal INTERFACE) add_library(Zeek::Internal ALIAS zeek_internal) set_target_properties(zeek_internal PROPERTIES EXPORT_NAME Internal) @@ -204,11 +200,11 @@ if (ZEEK_STANDALONE) set_target_properties(zeek_exe PROPERTIES RUNTIME_OUTPUT_NAME zeek) if (NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY) set_target_properties(zeek_exe PROPERTIES RUNTIME_OUTPUT_DIRECTORY src) - endif() + endif () install(TARGETS zeek_exe RUNTIME DESTINATION bin) # Export symbols from zeek executable for use by plugins set_target_properties(zeek_exe PROPERTIES ENABLE_EXPORTS ON) - if ( MSVC ) + if (MSVC) set(WINDOWS_EXPORT_ALL_SYMBOLS ON) endif () # Tell zeek_target_link_libraries to add library dependencies as PRIVATE. @@ -219,7 +215,7 @@ if (ZEEK_STANDALONE) endif () else () add_library(zeek_lib STATIC) -endif() +endif () if (TARGET zeek_lib) target_link_libraries(zeek_lib PRIVATE $) @@ -227,15 +223,15 @@ if (TARGET zeek_lib) set_target_properties(zeek_lib PROPERTIES RUNTIME_OUTPUT_NAME libzeek) if (NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY) set_target_properties(zeek_lie PROPERTIES LIBRARY_OUTPUT_DIRECTORY src) - endif() + endif () install(TARGETS zeek_lib LIBRARY DESTINATION lib) # Tell zeek_target_link_libraries to add library dependencies as PRIVATE. set(zeek_lib_access PRIVATE) -endif() +endif () # When building our fuzzers, we also need one extra top-level target that # bundles all of our object libraries and other dependencies. -if ( ZEEK_ENABLE_FUZZERS ) +if (ZEEK_ENABLE_FUZZERS) add_library(zeek_fuzzer_shared SHARED) target_link_libraries(zeek_fuzzer_shared PUBLIC $) # Tell zeek_target_link_libraries to add library dependencies as PUBLIC. @@ -243,15 +239,15 @@ if ( ZEEK_ENABLE_FUZZERS ) endif () # Convenience function for adding library dependencies to the main target(s). -function(zeek_target_link_libraries lib_target) +function (zeek_target_link_libraries lib_target) foreach (name zeek_exe zeek_lib zeek_fuzzer_shared) if (TARGET ${name}) target_link_libraries(${name} ${${name}_access} ${lib_target}) endif () - endforeach() -endfunction() + endforeach () +endfunction () -function(zeek_include_directories) +function (zeek_include_directories) foreach (name zeek_exe zeek_lib zeek_fuzzer_shared) if (TARGET ${name}) target_include_directories(${name} ${${name}_access} ${ARGN}) @@ -260,53 +256,40 @@ function(zeek_include_directories) endfunction () # Convenience function for adding a dependency to the main target(s). -function(zeek_add_dependencies dep) +function (zeek_add_dependencies dep) foreach (name zeek_exe zeek_lib zeek_fuzzer_shared) if (TARGET ${name}) add_dependencies(${name} ${dep}) endif () - endforeach() -endfunction() + endforeach () +endfunction () # Interface library for propagating extra flags and include paths to dynamically # loaded plugins. Also propagates include paths and C++17 mode on the install # interface. add_library(zeek_dynamic_plugin_base INTERFACE) -target_link_libraries(zeek_dynamic_plugin_base - INTERFACE - $) -target_include_directories(zeek_dynamic_plugin_base - INTERFACE - $ - $ - $) +target_link_libraries(zeek_dynamic_plugin_base INTERFACE $) +target_include_directories( + zeek_dynamic_plugin_base + INTERFACE $ $ + $) target_compile_features(zeek_dynamic_plugin_base INTERFACE ${ZEEK_CXX_STD}) add_library(Zeek::DynamicPluginBase ALIAS zeek_dynamic_plugin_base) -set_target_properties( - zeek_dynamic_plugin_base PROPERTIES - EXPORT_NAME DynamicPluginBase) +set_target_properties(zeek_dynamic_plugin_base PROPERTIES EXPORT_NAME DynamicPluginBase) install(TARGETS zeek_dynamic_plugin_base EXPORT ZeekTargets) # On macOS, we need to tell the linker that the modules are allowed to have # undefined symbols. if (CMAKE_SYSTEM_NAME MATCHES "Darwin") - target_link_options( - zeek_dynamic_plugin_base - INTERFACE - -undefined - dynamic_lookup - -Wl,-bind_at_load) + target_link_options(zeek_dynamic_plugin_base INTERFACE -undefined dynamic_lookup + -Wl,-bind_at_load) endif () -function(add_zeek_dynamic_plugin_build_interface_include_directories) - foreach ( path ${ARGV} ) - target_include_directories( - zeek_dynamic_plugin_base - INTERFACE - $ - ) +function (add_zeek_dynamic_plugin_build_interface_include_directories) + foreach (path ${ARGV}) + target_include_directories(zeek_dynamic_plugin_base INTERFACE $) endforeach () -endfunction() +endfunction () add_zeek_dynamic_plugin_build_interface_include_directories( ${PROJECT_SOURCE_DIR}/src/include @@ -317,28 +300,20 @@ add_zeek_dynamic_plugin_build_interface_include_directories( ${CMAKE_BINARY_DIR}/src ${CMAKE_BINARY_DIR}/src/include ${CMAKE_BINARY_DIR}/auxil/binpac/lib - ${CMAKE_BINARY_DIR}/auxil/broker/include -) + ${CMAKE_BINARY_DIR}/auxil/broker/include) # Convenience function for adding an OBJECT library that feeds directly into the # main target(s). # -# Usage: -# zeek_add_subdir_library( -# -# SOURCES ... -# [INCLUDE_DIRS ...] -# [DEPENDENCIES ...] -# [INTERNAL_DEPENDENCIES ...] -# [BIFS ...] -# ) -function(zeek_add_subdir_library name) +# Usage: zeek_add_subdir_library( SOURCES ... [INCLUDE_DIRS ...] +# [DEPENDENCIES ...] [INTERNAL_DEPENDENCIES ...] [BIFS ...] ) +function (zeek_add_subdir_library name) # Parse arguments. set(fn_varargs INCLUDE_DIRS DEPENDENCIES INTERNAL_DEPENDENCIES SOURCES BIFS) cmake_parse_arguments(FN_ARGS "" "" "${fn_varargs}" ${ARGN}) if (NOT FN_ARGS_SOURCES) message(FATAL_ERROR "zeek_add_subdir_library called without any SOURCES") - endif() + endif () # Create target and add the sources. set(target_name "zeek_${name}_obj") @@ -349,82 +324,68 @@ function(zeek_add_subdir_library name) # Take care of compiling BIFs. if (FN_ARGS_BIFS) - foreach ( bif ${FN_ARGS_BIFS} ) - # Generate the target and add the extra dependency. - bif_target(${bif}) + foreach (bif ${FN_ARGS_BIFS}) + # Generate the target and add the extra dependency. + bif_target(${bif}) endforeach () - endif() + endif () # Optionally add include directories and extra dependencies. - if ( FN_ARGS_INCLUDE_DIRS ) - target_include_directories( - ${target_name} - BEFORE - PRIVATE - ${FN_ARGS_INCLUDE_DIRS}) + if (FN_ARGS_INCLUDE_DIRS) + target_include_directories(${target_name} BEFORE PRIVATE ${FN_ARGS_INCLUDE_DIRS}) endif () - if ( FN_ARGS_DEPENDENCIES ) + if (FN_ARGS_DEPENDENCIES) target_link_libraries(${target_name} PRIVATE ${FN_ARGS_DEPENDENCIES}) endif () - if ( FN_ARGS_INTERNAL_DEPENDENCIES ) - add_dependencies(${target_name} ${FN_ARGS_INTERNAL_DEPENDENCIES}) + if (FN_ARGS_INTERNAL_DEPENDENCIES) + add_dependencies(${target_name} ${FN_ARGS_INTERNAL_DEPENDENCIES}) endif () # Feed into the main Zeek target(s). zeek_target_link_libraries(${target_name}) -endfunction() +endfunction () -######################################################################## -## Utility function for forcing CMake to re-run if files change on disk. +# ############################################################################## +# Utility function for forcing CMake to re-run if files change on disk. -function(zeek_watch_files) - set_property( - DIRECTORY - APPEND - PROPERTY CMAKE_CONFIGURE_DEPENDS ${ARGN} - ) -endfunction() +function (zeek_watch_files) + set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${ARGN}) +endfunction () -######################################################################## -## Create empty __load__.zeek stubs (override pre-existing ones). +# ############################################################################## +# Create empty __load__.zeek stubs (override pre-existing ones). -function(zeek_create_load_script_stubs) +function (zeek_create_load_script_stubs) set(file_comment "# Warning, this is an autogenerated file!\n") - foreach ( fpath ${ARGN} ) + foreach (fpath ${ARGN}) file(WRITE "${CMAKE_BINARY_DIR}/${fpath}" "${file_comment}") zeek_watch_files("${CMAKE_BINARY_DIR}/${fpath}") endforeach () endfunction () # Note: these files are filled from BifCl.cmake via `file(APPEND ...)` -zeek_create_load_script_stubs( - scripts/builtin-plugins/__load__.zeek - scripts/base/bif/plugins/__load__.zeek - scripts/base/bif/__load__.zeek -) +zeek_create_load_script_stubs(scripts/builtin-plugins/__load__.zeek + scripts/base/bif/plugins/__load__.zeek scripts/base/bif/__load__.zeek) -######################################################################## -## Create empty __all__*.cc stubs (override pre-existing ones). +# ############################################################################## +# Create empty __all__*.cc stubs (override pre-existing ones). -function(zeek_create_bif_autogen_stubs) +function (zeek_create_bif_autogen_stubs) set(file_comment "// Warning, this is an autogenerated file!\n") - foreach ( fpath ${ARGN} ) + foreach (fpath ${ARGN}) file(WRITE "${CMAKE_BINARY_DIR}/${fpath}" "${file_comment}") zeek_watch_files("${CMAKE_BINARY_DIR}/${fpath}") endforeach () endfunction () # Note: these files are filled from BifCl.cmake via `file(APPEND ...)`. -zeek_create_bif_autogen_stubs( - src/__all__.bif.cc - src/__all__.bif.init.cc - src/__all__.bif.register.cc -) +zeek_create_bif_autogen_stubs(src/__all__.bif.cc src/__all__.bif.init.cc + src/__all__.bif.register.cc) -######################################################################## -## Project/Build Configuration +# ############################################################################## +# Project/Build Configuration -if ( ZEEK_ENABLE_FUZZERS ) +if (ZEEK_ENABLE_FUZZERS) # Fuzzers use shared lib to save disk space, so need -fPIC on everything set(CMAKE_POSITION_INDEPENDENT_CODE ON) endif () @@ -436,15 +397,15 @@ else () add_definitions(-DDOCTEST_CONFIG_DISABLE) endif () -if ( ENABLE_CCACHE ) +if (ENABLE_CCACHE) find_program(CCACHE_PROGRAM ccache) - if ( NOT CCACHE_PROGRAM ) + if (NOT CCACHE_PROGRAM) message(FATAL_ERROR "ccache not found") endif () message(STATUS "Using ccache: ${CCACHE_PROGRAM}") - set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_PROGRAM}) + set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_PROGRAM}) set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_PROGRAM}) endif () @@ -459,57 +420,59 @@ if (NOT ZEEK_MAN_INSTALL_PATH) set(ZEEK_MAN_INSTALL_PATH ${ZEEK_ROOT_DIR}/share/man) endif () -# sanitize the Zeek script install directory into an absolute path -# (CMake is confused by ~ as a representation of home directory) -get_filename_component(ZEEK_SCRIPT_INSTALL_PATH ${ZEEK_SCRIPT_INSTALL_PATH} - ABSOLUTE) +# sanitize the Zeek script install directory into an absolute path (CMake is +# confused by ~ as a representation of home directory) +get_filename_component(ZEEK_SCRIPT_INSTALL_PATH ${ZEEK_SCRIPT_INSTALL_PATH} ABSOLUTE) -# A folder for library-like Zeek-specific things: Python modules, Zeek -# plugins, etc. +# A folder for library-like Zeek-specific things: Python modules, Zeek plugins, +# etc. set(ZEEK_LIBDIR_PATH ${CMAKE_INSTALL_FULL_LIBDIR}/zeek) if (NOT ZEEK_PLUGIN_DIR) - set(ZEEK_PLUGIN_DIR ${ZEEK_LIBDIR_PATH}/plugins - CACHE STRING "Installation path for plugins" FORCE) -endif() + set(ZEEK_PLUGIN_DIR ${ZEEK_LIBDIR_PATH}/plugins CACHE STRING "Installation path for plugins" + FORCE) +endif () set(cmake_binary_dir "${CMAKE_BINARY_DIR}") set(cmake_current_binary_dir "${CMAKE_CURRENT_BINARY_DIR}") set(cmake_install_prefix "${CMAKE_INSTALL_PREFIX}") set(cmake_source_dir "${CMAKE_SOURCE_DIR}") set(zeek_script_install_path "${ZEEK_SCRIPT_INSTALL_PATH}") -if ( MSVC ) - # This has to happen before we modify the paths below so that - # the pure Windows paths are stored in the output file. +if (MSVC) + # This has to happen before we modify the paths below so that the pure Windows + # paths are stored in the output file. configure_file(zeek-path-dev.bat.in ${CMAKE_CURRENT_BINARY_DIR}/zeek-path-dev.bat) string(REGEX REPLACE "^([A-Za-z]):/(.*)" "/\\1/\\2" cmake_binary_dir "${cmake_binary_dir}") - string(REGEX REPLACE "^([A-Za-z]):/(.*)" "/\\1/\\2" cmake_current_binary_dir "${cmake_current_binary_dir}") - string(REGEX REPLACE "^([A-Za-z]):/(.*)" "/\\1/\\2" cmake_install_prefix "${cmake_install_prefix}") + string(REGEX REPLACE "^([A-Za-z]):/(.*)" "/\\1/\\2" cmake_current_binary_dir + "${cmake_current_binary_dir}") + string(REGEX REPLACE "^([A-Za-z]):/(.*)" "/\\1/\\2" cmake_install_prefix + "${cmake_install_prefix}") string(REGEX REPLACE "^([A-Za-z]):/(.*)" "/\\1/\\2" cmake_source_dir "${cmake_source_dir}") - string(REGEX REPLACE "^([A-Za-z]):/(.*)" "/\\1/\\2" zeek_script_install_path "${zeek_script_install_path}") + string(REGEX REPLACE "^([A-Za-z]):/(.*)" "/\\1/\\2" zeek_script_install_path + "${zeek_script_install_path}") endif () # Set the path where we install the ZeekConfig.cmake file and related files. set(ZEEK_CMAKE_CONFIG_DIR "${CMAKE_INSTALL_PREFIX}/share/zeek/cmake") -if ( NOT ZEEK_ETC_INSTALL_DIR ) +if (NOT ZEEK_ETC_INSTALL_DIR) set(ZEEK_ETC_INSTALL_DIR ${ZEEK_ROOT_DIR}/etc) endif () -if ( NOT ZEEK_STATE_DIR ) +if (NOT ZEEK_STATE_DIR) set(ZEEK_STATE_DIR ${ZEEK_ROOT_DIR}/var/lib) endif () -if ( NOT ZEEK_SPOOL_DIR ) +if (NOT ZEEK_SPOOL_DIR) set(ZEEK_SPOOL_DIR ${ZEEK_ROOT_DIR}/spool) endif () -if ( NOT ZEEK_LOG_DIR ) +if (NOT ZEEK_LOG_DIR) set(ZEEK_LOG_DIR ${ZEEK_ROOT_DIR}/logs) endif () -if ( NOT MSVC ) +if (NOT MSVC) set(HAVE_SUPERVISOR true) endif () @@ -520,25 +483,28 @@ install(DIRECTORY DESTINATION ${ZEEK_LOG_DIR}) configure_file(zeek-path-dev.in ${CMAKE_CURRENT_BINARY_DIR}/zeek-path-dev) -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zeek-path-dev.sh - "export ZEEKPATH=`${cmake_binary_dir}/zeek-path-dev`\n" - "export ZEEK_PLUGIN_PATH=\"${cmake_binary_dir}/src\":$\{ZEEK_PLUGIN_PATH\}\n" - "export PATH=\"${cmake_binary_dir}\":\"${cmake_binary_dir}/src\":\"${cmake_binary_dir}/auxil/spicy/spicy/bin\":\"${cmake_binary_dir}/src/builtin-plugins/spicy-plugin/bin\":$\{PATH\}\n" - "export SPICY_PATH=`${cmake_binary_dir}/spicy-path`\n" - "export HILTI_CXX_INCLUDE_DIRS=`${cmake_binary_dir}/hilti-cxx-include-dirs`\n") +file( + WRITE ${CMAKE_CURRENT_BINARY_DIR}/zeek-path-dev.sh + "export ZEEKPATH=`${cmake_binary_dir}/zeek-path-dev`\n" + "export ZEEK_PLUGIN_PATH=\"${cmake_binary_dir}/src\":$\{ZEEK_PLUGIN_PATH\}\n" + "export PATH=\"${cmake_binary_dir}\":\"${cmake_binary_dir}/src\":\"${cmake_binary_dir}/auxil/spicy/spicy/bin\":\"${cmake_binary_dir}/src/builtin-plugins/spicy-plugin/bin\":$\{PATH\}\n" + "export SPICY_PATH=`${cmake_binary_dir}/spicy-path`\n" + "export HILTI_CXX_INCLUDE_DIRS=`${cmake_binary_dir}/hilti-cxx-include-dirs`\n") -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zeek-path-dev.csh - "setenv ZEEKPATH `${cmake_binary_dir}/zeek-path-dev`\n" - "setenv ZEEK_PLUGIN_PATH \"${cmake_binary_dir}/src\":$\{ZEEK_PLUGIN_PATH\}\n" - "setenv PATH \"${cmake_binary_dir}\":\"${cmake_binary_dir}/src\":\"${cmake_binary_dir}/auxil/spicy/spicy/bin\":\"${cmake_binary_dir}/src/builtin-plugins/spicy-plugin/bin\":$\{PATH\}\n" - "setenv SPICY_PATH \"`${cmake_binary_dir}/spicy-path`\"\n" - "setenv HILTI_CXX_INCLUDE_DIRS \"`${cmake_binary_dir}/hilti-cxx-include-dirs`\"\n") +file( + WRITE ${CMAKE_CURRENT_BINARY_DIR}/zeek-path-dev.csh + "setenv ZEEKPATH `${cmake_binary_dir}/zeek-path-dev`\n" + "setenv ZEEK_PLUGIN_PATH \"${cmake_binary_dir}/src\":$\{ZEEK_PLUGIN_PATH\}\n" + "setenv PATH \"${cmake_binary_dir}\":\"${cmake_binary_dir}/src\":\"${cmake_binary_dir}/auxil/spicy/spicy/bin\":\"${cmake_binary_dir}/src/builtin-plugins/spicy-plugin/bin\":$\{PATH\}\n" + "setenv SPICY_PATH \"`${cmake_binary_dir}/spicy-path`\"\n" + "setenv HILTI_CXX_INCLUDE_DIRS \"`${cmake_binary_dir}/hilti-cxx-include-dirs`\"\n") file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/VERSION" VERSION LIMIT_COUNT 1) -execute_process(COMMAND grep "^constexpr int PLUGIN_API_VERSION" - INPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/src/plugin/Plugin.h - OUTPUT_VARIABLE API_VERSION - OUTPUT_STRIP_TRAILING_WHITESPACE) +execute_process( + COMMAND grep "^constexpr int PLUGIN_API_VERSION" + INPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/src/plugin/Plugin.h + OUTPUT_VARIABLE API_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE) string(REGEX MATCH "^constexpr int PLUGIN_API_VERSION = ([0-9]+);" API_VERSION "${API_VERSION}") set(API_VERSION "${CMAKE_MATCH_1}") @@ -556,15 +522,16 @@ set(VERSION_C_IDENT "${VERSION}_plugin_${API_VERSION}") string(REGEX REPLACE "-[0-9]*$" "_git" VERSION_C_IDENT "${VERSION_C_IDENT}") string(REGEX REPLACE "[^a-zA-Z0-9_\$]" "_" VERSION_C_IDENT "${VERSION_C_IDENT}") -if(ENABLE_DEBUG) +if (ENABLE_DEBUG) set(VERSION_C_IDENT "${VERSION_C_IDENT}_debug") target_compile_definitions(zeek_internal INTERFACE DEBUG) target_compile_definitions(zeek_dynamic_plugin_base INTERFACE DEBUG) -endif() +endif () -if ( NOT BINARY_PACKAGING_MODE ) - macro(_make_install_dir_symlink _target _link) - install(CODE " +if (NOT BINARY_PACKAGING_MODE) + macro (_make_install_dir_symlink _target _link) + install( + CODE " if ( \"\$ENV{DESTDIR}\" STREQUAL \"\" ) if ( EXISTS \"${_target}\" AND NOT EXISTS \"${_link}\" ) message(STATUS \"WARNING: installed ${_link} as symlink to ${_target}\") @@ -573,84 +540,91 @@ if ( NOT BINARY_PACKAGING_MODE ) endif () endif () ") - endmacro() + endmacro () - if ( "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr/local/zeek" ) - # If we're installing into the default prefix, check if the - # old default prefix already exists and symlink to it. - # This is done to help keep custom user configuration/installation - # if they're upgrading from a version before Zeek 3.0. + if ("${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr/local/zeek") + # If we're installing into the default prefix, check if the old default + # prefix already exists and symlink to it. This is done to help keep custom + # user configuration/installation if they're upgrading from a version before + # Zeek 3.0. _make_install_dir_symlink("/usr/local/bro" "/usr/local/zeek") endif () - # Check whether we need to symlink directories used by versions - # before Zeek 3.0. - _make_install_dir_symlink("${CMAKE_INSTALL_PREFIX}/include/bro" "${CMAKE_INSTALL_PREFIX}/include/zeek") - _make_install_dir_symlink("${CMAKE_INSTALL_PREFIX}/share/bro" "${CMAKE_INSTALL_PREFIX}/share/zeek") + # Check whether we need to symlink directories used by versions before Zeek + # 3.0. + _make_install_dir_symlink("${CMAKE_INSTALL_PREFIX}/include/bro" + "${CMAKE_INSTALL_PREFIX}/include/zeek") + _make_install_dir_symlink("${CMAKE_INSTALL_PREFIX}/share/bro" + "${CMAKE_INSTALL_PREFIX}/share/zeek") _make_install_dir_symlink("${CMAKE_INSTALL_PREFIX}/lib/bro" "${CMAKE_INSTALL_FULL_LIBDIR}/zeek") endif () -if ( ZEEK_SANITIZERS ) +if (ZEEK_SANITIZERS) # Check the thread library info early as setting compiler flags seems to - # interfere with the detection and cause CMAKE_THREAD_LIBS_INIT to not - # include -lpthread when it should. + # interfere with the detection and cause CMAKE_THREAD_LIBS_INIT to not include + # -lpthread when it should. find_package(Threads) string(REPLACE "," " " _sanitizer_args "${ZEEK_SANITIZERS}") separate_arguments(_sanitizer_args) set(ZEEK_SANITIZERS "") - foreach ( _sanitizer ${_sanitizer_args} ) - if ( ZEEK_SANITIZERS ) + foreach (_sanitizer ${_sanitizer_args}) + if (ZEEK_SANITIZERS) set(ZEEK_SANITIZERS "${ZEEK_SANITIZERS},") endif () - if ( _sanitizer STREQUAL "thread" ) + if (_sanitizer STREQUAL "thread") set(ZEEK_TSAN true) endif () - if ( NOT _sanitizer STREQUAL "undefined" ) + if (NOT _sanitizer STREQUAL "undefined") set(ZEEK_SANITIZERS "${ZEEK_SANITIZERS}${_sanitizer}") continue() endif () - if ( NOT DEFINED ZEEK_SANITIZER_UB_CHECKS ) - if ( DEFINED ENV{ZEEK_TAILORED_UB_CHECKS} ) + if (NOT DEFINED ZEEK_SANITIZER_UB_CHECKS) + if (DEFINED ENV{ZEEK_TAILORED_UB_CHECKS}) # list(APPEND _check_list "alignment") # TODO: fix associated errors list(APPEND _check_list "bool") # list(APPEND _check_list "builtin") # Not implemented in older GCCs - list(APPEND _check_list "bounds") # Covers both array/local bounds options below + list(APPEND _check_list "bounds") # Covers both array/local bounds + # options below # list(APPEND _check_list "array-bounds") # Not implemented by GCC - # list(APPEND _check_list "local-bounds") # Not normally part of "undefined" + # list(APPEND _check_list "local-bounds") # Not normally part of + # "undefined" list(APPEND _check_list "enum") list(APPEND _check_list "float-cast-overflow") list(APPEND _check_list "float-divide-by-zero") # list(APPEND _check_list "function") # Not implemented by GCC - # list(APPEND _check_list "implicit-unsigned-integer-truncation") # Not truly UB - # list(APPEND _check_list "implicit-signed-integer-truncation") # Not truly UB - # list(APPEND _check_list "implicit-integer-sign-change") # Not truly UB + # list(APPEND _check_list "implicit-unsigned-integer-truncation") # Not + # truly UB list(APPEND _check_list "implicit-signed-integer-truncation") + # # Not truly UB list(APPEND _check_list "implicit-integer-sign-change") + # # Not truly UB list(APPEND _check_list "integer-divide-by-zero") list(APPEND _check_list "nonnull-attribute") list(APPEND _check_list "null") - # list(APPEND _check_list "nullability-arg") # Not normally part of "undefined" - # list(APPEND _check_list "nullability-assign") # Not normally part of "undefined" - # list(APPEND _check_list "nullability-return") # Not normally part of "undefined" - # list(APPEND _check_list "objc-cast") # Not truly UB - # list(APPEND _check_list "pointer-overflow") # Not implemented in older GCCs + # list(APPEND _check_list "nullability-arg") # Not normally part of + # "undefined" list(APPEND _check_list "nullability-assign") # Not + # normally part of "undefined" list(APPEND _check_list + # "nullability-return") # Not normally part of "undefined" list(APPEND + # _check_list "objc-cast") # Not truly UB list(APPEND _check_list + # "pointer-overflow") # Not implemented in older GCCs list(APPEND _check_list "return") list(APPEND _check_list "returns-nonnull-attribute") list(APPEND _check_list "shift") - # list(APPEND _check_list "unsigned-shift-base") # Not implemented by GCC + # list(APPEND _check_list "unsigned-shift-base") # Not implemented by + # GCC list(APPEND _check_list "signed-integer-overflow") list(APPEND _check_list "unreachable") # list(APPEND _check_list "unsigned-integer-overflow") # Not truly UB list(APPEND _check_list "vla-bound") list(APPEND _check_list "vptr") - # Clang complains if this one is defined and the optimizer is set to -O0. We - # only set that optimization level if NO_OPTIMIZATIONS is passed, so disable - # the option if that's set. - if ( NOT DEFINED ENV{NO_OPTIMIZATIONS} ) + # Clang complains if this one is defined and the optimizer is set to + # -O0. We only set that optimization level if NO_OPTIMIZATIONS is + # passed, so disable the option if that's set. + if (NOT DEFINED ENV{NO_OPTIMIZATIONS}) list(APPEND _check_list "object-size") endif () @@ -666,52 +640,54 @@ if ( ZEEK_SANITIZERS ) set(_sanitizer_flags "-fsanitize=${ZEEK_SANITIZERS}") - # The linker command used by check_cxx_compiler_flag requires you to also pass the sanitizer to - # it or it fails. The best way to do this is to set CMAKE_REQUIRED_LINK_OPTIONS, but save off a - # copy of it so it can be reset back to what it was previously afterwards. + # The linker command used by check_cxx_compiler_flag requires you to also pass + # the sanitizer to it or it fails. The best way to do this is to set + # CMAKE_REQUIRED_LINK_OPTIONS, but save off a copy of it so it can be reset + # back to what it was previously afterwards. set(_temp_link_options ${CMAKE_REQUIRED_LINK_OPTIONS}) list(APPEND CMAKE_REQUIRED_LINK_OPTIONS ${_sanitizer_flags}) include(CheckCXXCompilerFlag) check_cxx_compiler_flag(${_sanitizer_flags} COMPILER_SUPPORTS_SANITIZERS) - if ( NOT COMPILER_SUPPORTS_SANITIZERS ) - message(FATAL_ERROR "Invalid sanitizer compiler flags: ${_sanitizer_flags}") - endif() + if (NOT COMPILER_SUPPORTS_SANITIZERS) + message(FATAL_ERROR "Invalid sanitizer compiler flags: ${_sanitizer_flags}") + endif () set(CMAKE_REQUIRED_LINK_OPTIONS ${_temp_link_options}) - if ( ZEEK_SANITIZER_UB_CHECKS ) - set(_sanitizer_flags "${_sanitizer_flags} -fno-sanitize-recover=${ZEEK_SANITIZER_UB_CHECKS}") + if (ZEEK_SANITIZER_UB_CHECKS) + set(_sanitizer_flags + "${_sanitizer_flags} -fno-sanitize-recover=${ZEEK_SANITIZER_UB_CHECKS}") endif () set(_sanitizer_flags "${_sanitizer_flags} -fno-omit-frame-pointer") set(_sanitizer_flags "${_sanitizer_flags} -fno-optimize-sibling-calls") - if ( NOT DEFINED ZEEK_SANITIZER_OPTIMIZATIONS ) - if ( DEFINED ENV{NO_OPTIMIZATIONS} ) + if (NOT DEFINED ZEEK_SANITIZER_OPTIMIZATIONS) + if (DEFINED ENV{NO_OPTIMIZATIONS}) # Using -O1 is generally the suggestion to get more reasonable - # performance. The one downside is it that the compiler may - # optimize out code that otherwise generates an error/leak in a -O0 - # build, but that should be rare and users mostly will not be - # running unoptimized builds in production anyway. + # performance. The one downside is it that the compiler may optimize out + # code that otherwise generates an error/leak in a -O0 build, but that + # should be rare and users mostly will not be running unoptimized builds + # in production anyway. set(ZEEK_SANITIZER_OPTIMIZATIONS false CACHE INTERNAL "" FORCE) else () set(ZEEK_SANITIZER_OPTIMIZATIONS true CACHE INTERNAL "" FORCE) endif () endif () - if ( ZEEK_SANITIZER_OPTIMIZATIONS ) + if (ZEEK_SANITIZER_OPTIMIZATIONS) set(_sanitizer_flags "${_sanitizer_flags} -O1") endif () - # Technically, the we also need to use the compiler to drive linking and - # give the sanitizer flags there, too. However, CMake, by default, uses - # the compiler for linking and so the automatically flags get used. See + # Technically, the we also need to use the compiler to drive linking and give + # the sanitizer flags there, too. However, CMake, by default, uses the + # compiler for linking and so the automatically flags get used. See # https://cmake.org/pipermail/cmake/2014-August/058268.html set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_sanitizer_flags}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_sanitizer_flags}") -endif() +endif () -######################################################################## -## Dependency Configuration +# ############################################################################## +# Dependency Configuration include(FindRequiredPackage) @@ -731,14 +707,14 @@ FindRequiredPackage(FLEX) FindRequiredPackage(BISON) FindRequiredPackage(PCAP) FindRequiredPackage(OpenSSL) -if ( NOT MSVC ) +if (NOT MSVC) FindRequiredPackage(BIND) endif () FindRequiredPackage(ZLIB) # Forward user-defined hint for OpenSSL to the plugins. Use a cache variable to -# make sure this variable survives CMake re-runs. -# Note: This variable is picked up in ZeekPluginConfig.cmake.in. +# make sure this variable survives CMake re-runs. Note: This variable is picked +# up in ZeekPluginConfig.cmake.in. if (OPENSSL_ROOT_DIR) set(ZeekOpenSSLHint "${OPENSSL_ROOT_DIR}" CACHE INTERNAL "" FORCE) elseif (DEFINED ENV{OPENSSL_ROOT_DIR}) @@ -746,18 +722,17 @@ elseif (DEFINED ENV{OPENSSL_ROOT_DIR}) endif () # Forward PKG_CONFIG_PATH to the plugins. Use a cache variable to make sure this -# variable survives CMake re-runs. -# Note: This variable is picked up in ZeekPluginConfig.cmake.in. +# variable survives CMake re-runs. Note: This variable is picked up in +# ZeekPluginConfig.cmake.in. if (DEFINED ENV{PKG_CONFIG_PATH}) set(ZeekPkgConfigPath "$ENV{PKG_CONFIG_PATH}" CACHE INTERNAL "" FORCE) endif () -# Installation directory for the distribution's Python modules. An -# override via configure's --python-dir wins, specifying a directory -# explicitly. Next is --python-prefix, which includes a versioned -# Python folder as the --prefix option in distutils does. Next -# consider a distutils --home style override via --python-home, and -# finally default to "zeek/python" in our libdir. +# Installation directory for the distribution's Python modules. An override via +# configure's --python-dir wins, specifying a directory explicitly. Next is +# --python-prefix, which includes a versioned Python folder as the --prefix +# option in distutils does. Next consider a distutils --home style override via +# --python-home, and finally default to "zeek/python" in our libdir. if (ZEEK_PYTHON_DIR) set(py_mod_install_dir ${ZEEK_PYTHON_DIR}) elseif (ZEEK_PYTHON_PREFIX) @@ -768,25 +743,25 @@ elseif (ZEEK_PYTHON_HOME) else () set(py_mod_install_dir ${ZEEK_LIBDIR_PATH}/python) endif () -set(PY_MOD_INSTALL_DIR ${py_mod_install_dir} - CACHE STRING "Installation path for Python modules" FORCE) +set(PY_MOD_INSTALL_DIR ${py_mod_install_dir} CACHE STRING "Installation path for Python modules" + FORCE) if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/auxil/binpac/CMakeLists.txt) set(ENABLE_STATIC_ONLY_SAVED ${ENABLE_STATIC_ONLY}) - if ( MSVC ) + if (MSVC) set(BUILD_STATIC_BINPAC true) - endif() + endif () - if ( BUILD_STATIC_BINPAC ) - set(ENABLE_STATIC_ONLY true) - endif() + if (BUILD_STATIC_BINPAC) + set(ENABLE_STATIC_ONLY true) + endif () add_subdirectory(auxil/binpac) set(ENABLE_STATIC_ONLY ${ENABLE_STATIC_ONLY_SAVED}) - # FIXME: avoid hard-coding a path for multi-config generator support. - # See the TODO in ZeekPluginConfig.cmake.in. + # FIXME: avoid hard-coding a path for multi-config generator support. See the + # TODO in ZeekPluginConfig.cmake.in. set(BINPAC_EXE_PATH "${CMAKE_BINARY_DIR}/auxil/binpac/src/binpac${CMAKE_EXECUTABLE_SUFFIX}") endif () FindRequiredPackage(BinPAC) @@ -794,22 +769,21 @@ FindRequiredPackage(BinPAC) # Add an alias (used by our plugin setup). add_executable(Zeek::BinPAC ALIAS binpac) -if ( NOT BIFCL_EXE_PATH ) +if (NOT BIFCL_EXE_PATH) add_subdirectory(auxil/bifcl) add_executable(Zeek::BifCl ALIAS bifcl) - # FIXME: avoid hard-coding a path for multi-config generator support. - # See the TODO in ZeekPluginConfig.cmake.in. + # FIXME: avoid hard-coding a path for multi-config generator support. See the + # TODO in ZeekPluginConfig.cmake.in. set(BIFCL_EXE_PATH "${CMAKE_BINARY_DIR}/auxil/bifcl/bifcl${CMAKE_EXECUTABLE_SUFFIX}") set(_bifcl_exe_path "included") -else ( ) +else () add_executable(Zeek::BifCl IMPORTED) - set_property(TARGET Zeek::BifCl PROPERTY - IMPORTED_LOCATION "${BIFCL_EXE_PATH}") + set_property(TARGET Zeek::BifCl PROPERTY IMPORTED_LOCATION "${BIFCL_EXE_PATH}") set(_bifcl_exe_path "BIFCL_EXE_PATH") endif () -if ( NOT GEN_ZAM_EXE_PATH ) - add_subdirectory(auxil/gen-zam) +if (NOT GEN_ZAM_EXE_PATH) + add_subdirectory(auxil/gen-zam) endif () if (ENABLE_JEMALLOC) @@ -817,20 +791,20 @@ if (ENABLE_JEMALLOC) if (DEFINED JEMALLOC_ROOT_DIR) # Look for jemalloc at a specific path find_package(JeMalloc) - else() + else () # jemalloc is in the base system set(JEMALLOC_FOUND true) - endif() - else() + endif () + else () find_package(JeMalloc) - endif() + endif () if (NOT JEMALLOC_FOUND) message(FATAL_ERROR "Could not find requested JeMalloc") - endif() + endif () endif () -if ( BISON_VERSION AND BISON_VERSION VERSION_LESS 2.5 ) +if (BISON_VERSION AND BISON_VERSION VERSION_LESS 2.5) set(MISSING_PREREQS true) list(APPEND MISSING_PREREQ_DESCS " Could not find prerequisite package Bison >= 2.5, found: ${BISON_VERSION}") @@ -845,12 +819,12 @@ endif () set(ZEEK_PYTHON_MIN 3.5.0) -if ( PYTHON_VERSION_STRING VERSION_LESS ${ZEEK_PYTHON_MIN} ) +if (PYTHON_VERSION_STRING VERSION_LESS ${ZEEK_PYTHON_MIN}) message(FATAL_ERROR "Python ${ZEEK_PYTHON_MIN} or greater is required.") endif () add_subdirectory(auxil/paraglob) -if ( MSVC ) +if (MSVC) cmake_policy(SET CMP0079 NEW) target_link_libraries(paraglob shlwapi) set(BROKER_DISABLE_TOOLS true) @@ -858,56 +832,54 @@ endif () set(zeekdeps ${zeekdeps} paraglob) # Note: Broker gets some special attention in ZeekConfig.cmake.in. -if ( Broker_ROOT ) - find_package(Broker REQUIRED CONFIG) - list(APPEND zeekdeps ${BROKER_LIBRARY}) - set(broker_includes ${BROKER_INCLUDE_DIR}) - set(ZEEK_HAS_EXTERNAL_BROKER ON) - set(ZEEK_HAS_STATIC_BROKER OFF) -else () - if ( ZEEK_SANITIZERS ) - set(BROKER_SANITIZERS ${ZEEK_SANITIZERS}) - endif () - - set(ENABLE_STATIC_ONLY_SAVED ${ENABLE_STATIC_ONLY}) - if ( MSVC ) - set(BUILD_STATIC_BROKER true) - endif() - - if ( BUILD_STATIC_BROKER ) - set(ENABLE_STATIC_ONLY true) - endif() - - add_subdirectory(auxil/broker) - set(ENABLE_STATIC_ONLY ${ENABLE_STATIC_ONLY_SAVED}) - - if ( BUILD_STATIC_BROKER ) - list(APPEND zeekdeps broker_static) - else() - list(APPEND zeekdeps broker) - endif() - - set( - broker_includes - ${CMAKE_CURRENT_SOURCE_DIR}/auxil/broker/include - ${CMAKE_CURRENT_BINARY_DIR}/auxil/broker/include) - - if (BUILD_STATIC_BROKER) - set(ZEEK_HAS_STATIC_BROKER ON) - else () +if (Broker_ROOT) + find_package(Broker REQUIRED CONFIG) + list(APPEND zeekdeps ${BROKER_LIBRARY}) + set(broker_includes ${BROKER_INCLUDE_DIR}) + set(ZEEK_HAS_EXTERNAL_BROKER ON) set(ZEEK_HAS_STATIC_BROKER OFF) - endif () - set(ZEEK_HAS_EXTERNAL_BROKER OFF) +else () + if (ZEEK_SANITIZERS) + set(BROKER_SANITIZERS ${ZEEK_SANITIZERS}) + endif () - # Tell plugins where to find the Broker CMake package in the source tree. - # This variable is picked up in ZeekPluginConfig.cmake.in. - set(ZEEK_PLUGIN_BROKER_PATH "${CMAKE_CURRENT_BINARY_DIR}/auxil/broker") + set(ENABLE_STATIC_ONLY_SAVED ${ENABLE_STATIC_ONLY}) + if (MSVC) + set(BUILD_STATIC_BROKER true) + endif () + + if (BUILD_STATIC_BROKER) + set(ENABLE_STATIC_ONLY true) + endif () + + add_subdirectory(auxil/broker) + set(ENABLE_STATIC_ONLY ${ENABLE_STATIC_ONLY_SAVED}) + + if (BUILD_STATIC_BROKER) + list(APPEND zeekdeps broker_static) + else () + list(APPEND zeekdeps broker) + endif () + + set(broker_includes ${CMAKE_CURRENT_SOURCE_DIR}/auxil/broker/include + ${CMAKE_CURRENT_BINARY_DIR}/auxil/broker/include) + + if (BUILD_STATIC_BROKER) + set(ZEEK_HAS_STATIC_BROKER ON) + else () + set(ZEEK_HAS_STATIC_BROKER OFF) + endif () + set(ZEEK_HAS_EXTERNAL_BROKER OFF) + + # Tell plugins where to find the Broker CMake package in the source tree. This + # variable is picked up in ZeekPluginConfig.cmake.in. + set(ZEEK_PLUGIN_BROKER_PATH "${CMAKE_CURRENT_BINARY_DIR}/auxil/broker") endif () -if ( NOT DISABLE_SPICY ) +if (NOT DISABLE_SPICY) set(USE_SPICY_ANALYZERS yes) - if ( NOT SPICY_ROOT_DIR ) + if (NOT SPICY_ROOT_DIR) set(HAVE_SPICY yes) # evaluated by Spicy plugin build add_subdirectory(auxil/spicy) @@ -931,26 +903,19 @@ if ( NOT DISABLE_SPICY ) set(SPICY_LIBRARY_RT_DEBUG spicy-rt-debug) # Needed only for logging from CMake configure phase. + get_directory_property(SPICY_VERSION DIRECTORY ${PROJECT_SOURCE_DIR}/auxil/spicy/spicy + DEFINITION SPICY_VERSION) get_directory_property( - SPICY_VERSION - DIRECTORY ${PROJECT_SOURCE_DIR}/auxil/spicy/spicy - DEFINITION SPICY_VERSION) - get_directory_property( - SPICY_VERSION_NUMBER - DIRECTORY ${PROJECT_SOURCE_DIR}/auxil/spicy/spicy - DEFINITION SPICY_VERSION_NUMBER) - get_directory_property( - SPICY_PREFIX - DIRECTORY ${PROJECT_SOURCE_DIR}/auxil/spicy/spicy - DEFINITION CMAKE_INSTALL_PREFIX) - get_directory_property( - SPICY_BUILD_MODE - DIRECTORY ${PROJECT_SOURCE_DIR}/auxil/spicy/spicy - DEFINITION CMAKE_BUILD_TYPE) + SPICY_VERSION_NUMBER DIRECTORY ${PROJECT_SOURCE_DIR}/auxil/spicy/spicy DEFINITION + SPICY_VERSION_NUMBER) + get_directory_property(SPICY_PREFIX DIRECTORY ${PROJECT_SOURCE_DIR}/auxil/spicy/spicy + DEFINITION CMAKE_INSTALL_PREFIX) + get_directory_property(SPICY_BUILD_MODE DIRECTORY ${PROJECT_SOURCE_DIR}/auxil/spicy/spicy + DEFINITION CMAKE_BUILD_TYPE) set(SPICYC "") endif () - if ( NOT SPICY_PLUGIN_PATH ) + if (NOT SPICY_PLUGIN_PATH) set(_spicy_plugin "included") set(SPICY_PLUGIN_PATH ${CMAKE_SOURCE_DIR}/auxil/spicy-plugin) endif () @@ -965,13 +930,8 @@ endif () set(USE_SPICY_ANALYZERS "${USE_SPICY_ANALYZERS}" CACHE BOOL "Use built-in Spicy analyzers") include(BuiltInSpicyAnalyzer) -include_directories(BEFORE - ${PCAP_INCLUDE_DIR} - ${BIND_INCLUDE_DIR} - ${BinPAC_INCLUDE_DIR} - ${ZLIB_INCLUDE_DIR} - ${JEMALLOC_INCLUDE_DIR} -) +include_directories(BEFORE ${PCAP_INCLUDE_DIR} ${BIND_INCLUDE_DIR} ${BinPAC_INCLUDE_DIR} + ${ZLIB_INCLUDE_DIR} ${JEMALLOC_INCLUDE_DIR}) install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/auxil/rapidjson/include/rapidjson DESTINATION include/zeek/3rdparty/rapidjson/include) @@ -982,10 +942,12 @@ install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/auxil/filesystem/include/ghc # Create 3rdparty/ghc within the build directory so that the include for # "zeek/3rdparty/ghc/filesystem.hpp" works within the build tree. execute_process(COMMAND "${CMAKE_COMMAND}" -E make_directory - "${CMAKE_CURRENT_BINARY_DIR}/3rdparty/") -execute_process(COMMAND "${CMAKE_COMMAND}" -E create_symlink - "${CMAKE_CURRENT_SOURCE_DIR}/auxil/filesystem/include/ghc" - "${CMAKE_CURRENT_BINARY_DIR}/3rdparty/ghc") + "${CMAKE_CURRENT_BINARY_DIR}/3rdparty/") +execute_process( + COMMAND + "${CMAKE_COMMAND}" -E create_symlink + "${CMAKE_CURRENT_SOURCE_DIR}/auxil/filesystem/include/ghc" + "${CMAKE_CURRENT_BINARY_DIR}/3rdparty/ghc") # Optional Dependencies @@ -998,23 +960,23 @@ if (LIBMMDB_FOUND) endif () set(USE_KRB5 false) -if ( ${CMAKE_SYSTEM_NAME} MATCHES Linux ) - find_package(LibKrb5) - if (LIBKRB5_FOUND) - set(USE_KRB5 true) - include_directories(BEFORE ${LibKrb5_INCLUDE_DIR}) - list(APPEND OPTLIBS ${LibKrb5_LIBRARY}) - endif () +if (${CMAKE_SYSTEM_NAME} MATCHES Linux) + find_package(LibKrb5) + if (LIBKRB5_FOUND) + set(USE_KRB5 true) + include_directories(BEFORE ${LibKrb5_INCLUDE_DIR}) + list(APPEND OPTLIBS ${LibKrb5_LIBRARY}) + endif () endif () set(HAVE_PERFTOOLS false) set(USE_PERFTOOLS_DEBUG false) set(USE_PERFTOOLS_TCMALLOC false) -if ( ENABLE_PERFTOOLS ) - find_package(GooglePerftools) +if (ENABLE_PERFTOOLS) + find_package(GooglePerftools) - if ( GOOGLEPERFTOOLS_FOUND OR TCMALLOC_FOUND ) + if (GOOGLEPERFTOOLS_FOUND OR TCMALLOC_FOUND) set(HAVE_PERFTOOLS true) set(USE_PERFTOOLS_TCMALLOC true) @@ -1027,44 +989,44 @@ if ( ENABLE_PERFTOOLS ) # Link in tcmalloc. list(APPEND OPTLIBS ${GooglePerftools_LIBRARIES}) endif () - else() + else () message(FATAL_ERROR "Could not find requested Google Perftools.") endif () endif () -# Making sure any non-standard OpenSSL includes get searched earlier -# than other dependencies which tend to be in standard system locations -# and thus cause the system OpenSSL headers to still be picked up even -# if one specifies --with-openssl (which may be common). +# Making sure any non-standard OpenSSL includes get searched earlier than other +# dependencies which tend to be in standard system locations and thus cause the +# system OpenSSL headers to still be picked up even if one specifies +# --with-openssl (which may be common). include_directories(BEFORE ${OPENSSL_INCLUDE_DIR}) # Determine if libfts is external to libc, i.e. musl find_package(FTS) -if ( FTS_FOUND ) +if (FTS_FOUND) list(APPEND OPTLIBS ${FTS_LIBRARY}) include_directories(BEFORE ${FTS_INCLUDE_DIR}) endif () -# Any headers that are possibly bundled in the Zeek source-tree and that are supposed -# to have priority over any preexisting/system-wide headers need to appear early in -# compiler search path. +# Any headers that are possibly bundled in the Zeek source-tree and that are +# supposed to have priority over any preexisting/system-wide headers need to +# appear early in compiler search path. include_directories(BEFORE ${broker_includes}) include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/auxil/highwayhash) include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/auxil/paraglob/include) include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/auxil/rapidjson/include) -set(zeekdeps ${zeekdeps} +set(zeekdeps + ${zeekdeps} ${BinPAC_LIBRARY} ${PCAP_LIBRARY} ${OPENSSL_LIBRARIES} ${BIND_LIBRARY} ${ZLIB_LIBRARY} ${JEMALLOC_LIBRARIES} - ${OPTLIBS} -) + ${OPTLIBS}) -######################################################################## -## System Introspection +# ############################################################################## +# System Introspection include(TestBigEndian) test_big_endian(WORDS_BIGENDIAN) @@ -1085,19 +1047,19 @@ include(FindKqueue) include(FindCAres) include_directories(BEFORE "auxil/out_ptr/include") -if ( (OPENSSL_VERSION VERSION_EQUAL "1.1.0") OR (OPENSSL_VERSION VERSION_GREATER "1.1.0") ) - set(ZEEK_HAVE_OPENSSL_1_1 true CACHE INTERNAL "" FORCE) -endif() -if ( (OPENSSL_VERSION VERSION_EQUAL "3.0.0") OR (OPENSSL_VERSION VERSION_GREATER "3.0.0") ) - set(ZEEK_HAVE_OPENSSL_3_0 true CACHE INTERNAL "" FORCE) -endif() +if ((OPENSSL_VERSION VERSION_EQUAL "1.1.0") OR (OPENSSL_VERSION VERSION_GREATER "1.1.0")) + set(ZEEK_HAVE_OPENSSL_1_1 true CACHE INTERNAL "" FORCE) +endif () +if ((OPENSSL_VERSION VERSION_EQUAL "3.0.0") OR (OPENSSL_VERSION VERSION_GREATER "3.0.0")) + set(ZEEK_HAVE_OPENSSL_3_0 true CACHE INTERNAL "" FORCE) +endif () # Tell the plugin code that we're building as part of the main tree. set(ZEEK_PLUGIN_INTERNAL_BUILD true CACHE INTERNAL "" FORCE) -if ( ${CMAKE_SYSTEM_NAME} MATCHES Linux ) - if ( NOT DISABLE_AF_PACKET ) - if ( NOT AF_PACKET_PLUGIN_PATH ) +if (${CMAKE_SYSTEM_NAME} MATCHES Linux) + if (NOT DISABLE_AF_PACKET) + if (NOT AF_PACKET_PLUGIN_PATH) set(AF_PACKET_PLUGIN_PATH ${CMAKE_SOURCE_DIR}/auxil/zeek-af_packet-plugin) endif () @@ -1105,13 +1067,16 @@ if ( ${CMAKE_SYSTEM_NAME} MATCHES Linux ) endif () endif () -if ( NOT DISABLE_JAVASCRIPT ) +if (NOT DISABLE_JAVASCRIPT) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/auxil/zeekjs/cmake) find_package(Nodejs) - if ( NODEJS_FOUND ) - if ( ${NODEJS_VERSION} VERSION_LESS "16.13.0" ) - message(STATUS "Node.js version ${NODEJS_VERSION} is too old, need 16.13 or later. Not enabling JavaScript support.") + if (NODEJS_FOUND) + if (${NODEJS_VERSION} VERSION_LESS "16.13.0") + message( + STATUS + "Node.js version ${NODEJS_VERSION} is too old, need 16.13 or later. Not enabling JavaScript support." + ) set(ZEEK_HAVE_JAVASCRIPT no) else () set(ZEEKJS_PLUGIN_PATH ${CMAKE_SOURCE_DIR}/auxil/zeekjs) @@ -1125,14 +1090,16 @@ endif () set(ZEEK_HAVE_JAVASCRIPT ${ZEEK_HAVE_JAVASCRIPT} CACHE INTERNAL "Zeek has JavaScript support") -set(DEFAULT_ZEEKPATH_PATHS . ${ZEEK_SCRIPT_INSTALL_PATH} ${ZEEK_SCRIPT_INSTALL_PATH}/policy ${ZEEK_SCRIPT_INSTALL_PATH}/site ${ZEEK_SCRIPT_INSTALL_PATH}/builtin-plugins) -if ( MSVC ) +set(DEFAULT_ZEEKPATH_PATHS + . ${ZEEK_SCRIPT_INSTALL_PATH} ${ZEEK_SCRIPT_INSTALL_PATH}/policy + ${ZEEK_SCRIPT_INSTALL_PATH}/site ${ZEEK_SCRIPT_INSTALL_PATH}/builtin-plugins) +if (MSVC) list(JOIN DEFAULT_ZEEKPATH_PATHS ";" DEFAULT_ZEEKPATH) else () list(JOIN DEFAULT_ZEEKPATH_PATHS ":" DEFAULT_ZEEKPATH) endif () -if ( NOT BINARY_PACKAGING_MODE ) +if (NOT BINARY_PACKAGING_MODE) set(ZEEK_DIST ${PROJECT_SOURCE_DIR}) endif () @@ -1144,131 +1111,134 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/zeek-config.h.in ${CMAKE_CURRENT_BINARY_DIR}/zeek-config.h) include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/zeek-config.h DESTINATION include/zeek) -execute_process(COMMAND "${CMAKE_COMMAND}" -E create_symlink - "." - "${CMAKE_CURRENT_BINARY_DIR}/zeek") +execute_process(COMMAND "${CMAKE_COMMAND}" -E create_symlink "." "${CMAKE_CURRENT_BINARY_DIR}/zeek") -if ( BinPAC_ROOT_DIR ) - set(ZEEK_CONFIG_BINPAC_ROOT_DIR ${BinPAC_ROOT_DIR}) +if (BinPAC_ROOT_DIR) + set(ZEEK_CONFIG_BINPAC_ROOT_DIR ${BinPAC_ROOT_DIR}) else () - set(ZEEK_CONFIG_BINPAC_ROOT_DIR ${ZEEK_ROOT_DIR}) + set(ZEEK_CONFIG_BINPAC_ROOT_DIR ${ZEEK_ROOT_DIR}) endif () -if ( BROKER_ROOT_DIR ) - set(ZEEK_CONFIG_BROKER_ROOT_DIR ${BROKER_ROOT_DIR}) +if (BROKER_ROOT_DIR) + set(ZEEK_CONFIG_BROKER_ROOT_DIR ${BROKER_ROOT_DIR}) else () - set(ZEEK_CONFIG_BROKER_ROOT_DIR ${ZEEK_ROOT_DIR}) + set(ZEEK_CONFIG_BROKER_ROOT_DIR ${ZEEK_ROOT_DIR}) endif () -if ( PCAP_INCLUDE_DIR ) +if (PCAP_INCLUDE_DIR) set(ZEEK_CONFIG_PCAP_INCLUDE_DIR ${PCAP_INCLUDE_DIR}) endif () -if ( ZLIB_INCLUDE_DIR ) +if (ZLIB_INCLUDE_DIR) set(ZEEK_CONFIG_ZLIB_INCLUDE_DIR ${ZLIB_INCLUDE_DIR}) endif () -if ( OPENSSL_INCLUDE_DIR ) +if (OPENSSL_INCLUDE_DIR) set(ZEEK_CONFIG_OPENSSL_INCLUDE_DIR ${OPENSSL_INCLUDE_DIR}) endif () -if ( LibKrb5_INCLUDE_DIR ) +if (LibKrb5_INCLUDE_DIR) set(ZEEK_CONFIG_LibKrb5_INCLUDE_DIR ${LibKrb5_INCLUDE_DIR}) endif () -if ( GooglePerftools_INCLUDE_DIR ) +if (GooglePerftools_INCLUDE_DIR) set(ZEEK_CONFIG_GooglePerftools_INCLUDE_DIR ${GooglePerftools_INCLUDE_DIR}) endif () set(ZEEK_CONFIG_BTEST_TOOLS_DIR ${ZEEK_ROOT_DIR}/share/btest) install(DIRECTORY DESTINATION ${ZEEK_CONFIG_BTEST_TOOLS_DIR}) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/zeek-config.in - ${CMAKE_CURRENT_BINARY_DIR}/zeek-config @ONLY) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/zeek-config.in ${CMAKE_CURRENT_BINARY_DIR}/zeek-config + @ONLY) install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/zeek-config DESTINATION bin) -install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/cmake DESTINATION share/zeek - USE_SOURCE_PERMISSIONS - PATTERN ".git" EXCLUDE) +install( + DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/cmake + DESTINATION share/zeek + USE_SOURCE_PERMISSIONS + PATTERN ".git" EXCLUDE) -if ( NOT MSVC ) - # Install wrapper script for Bro-to-Zeek renaming. - include(InstallShellScript) - include(InstallSymlink) +if (NOT MSVC) + # Install wrapper script for Bro-to-Zeek renaming. + include(InstallShellScript) + include(InstallSymlink) endif () -######################################################################## -## zkg configuration +# ############################################################################## +# zkg configuration -if ( INSTALL_ZKG ) - # An etc/zkg directory for zkg's config file simplifies zkg's - # config file code. +if (INSTALL_ZKG) + # An etc/zkg directory for zkg's config file simplifies zkg's config file + # code. set(ZEEK_ZKG_CONFIG_DIR "${ZEEK_ETC_INSTALL_DIR}/zkg") set(ZEEK_ZKG_STATE_DIR "${ZEEK_STATE_DIR}/zkg") - configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/zkg-config.in - ${CMAKE_CURRENT_BINARY_DIR}/zkg-config @ONLY) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/zkg-config.in ${CMAKE_CURRENT_BINARY_DIR}/zkg-config + @ONLY) install(DIRECTORY DESTINATION var/lib/zkg) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/zkg-config - DESTINATION ${ZEEK_ZKG_CONFIG_DIR} RENAME config) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/zkg-config DESTINATION ${ZEEK_ZKG_CONFIG_DIR} + RENAME config) endif () -######################################################################## -## Look for external plugins to build in +# ############################################################################## +# Look for external plugins to build in string(REPLACE "," " " _build_in_plugins "${ZEEK_INCLUDE_PLUGINS}") separate_arguments(_build_in_plugins) -foreach(plugin_dir ${_build_in_plugins}) - if ( NOT IS_ABSOLUTE "${plugin_dir}/CMakeLists.txt" ) - message(FATAL_ERROR "Plugins to build in need to be defined with absolute path! ${plugin_dir}") - endif() +foreach (plugin_dir ${_build_in_plugins}) + if (NOT IS_ABSOLUTE "${plugin_dir}/CMakeLists.txt") + message( + FATAL_ERROR "Plugins to build in need to be defined with absolute path! ${plugin_dir}") + endif () - if ( NOT EXISTS "${plugin_dir}/CMakeLists.txt" ) - message(FATAL_ERROR "No plugin found at ${plugin_dir}!") - endif() + if (NOT EXISTS "${plugin_dir}/CMakeLists.txt") + message(FATAL_ERROR "No plugin found at ${plugin_dir}!") + endif () get_filename_component(plugin_name ${plugin_dir} NAME) - # Create a list of plugin directories that will then be added in the src/CMakeLists.txt + # Create a list of plugin directories that will then be added in the + # src/CMakeLists.txt list(APPEND BUILTIN_PLUGIN_LIST ${plugin_dir}) message(STATUS " Building in plugin: ${plugin_name} (${plugin_dir})") - if ( "${ZEEK_BUILTIN_PLUGINS}" STREQUAL "" ) + if ("${ZEEK_BUILTIN_PLUGINS}" STREQUAL "") set(ZEEK_BUILTIN_PLUGINS ${plugin_name}) else () set(ZEEK_BUILTIN_PLUGINS "${ZEEK_BUILTIN_PLUGINS}, ${plugin_name}") endif () -endforeach() +endforeach () -######################################################################## -## Populate the ZEEK_BUILD_INFO for use in src/version.c.in +# ############################################################################## +# Populate the ZEEK_BUILD_INFO for use in src/version.c.in -if ( WIN32 ) - # Windows installs Python to C:\Python311\python, but doesn't create a version - # or symlink to python3. Call python with the script directly since the shebang - # in the script won't work here. - execute_process(COMMAND "python" "${PROJECT_SOURCE_DIR}/ci/collect-repo-info.py" "${ZEEK_INCLUDE_PLUGINS}" - WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" - OUTPUT_VARIABLE ZEEK_BUILD_INFO - RESULT_VARIABLE ZEEK_BUILD_INFO_RESULT - OUTPUT_STRIP_TRAILING_WHITESPACE) -else() - execute_process(COMMAND "${PROJECT_SOURCE_DIR}/ci/collect-repo-info.py" "${ZEEK_INCLUDE_PLUGINS}" - WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" - OUTPUT_VARIABLE ZEEK_BUILD_INFO - RESULT_VARIABLE ZEEK_BUILD_INFO_RESULT - OUTPUT_STRIP_TRAILING_WHITESPACE) -endif() +if (WIN32) + # Windows installs Python to C:\Python311\python, but doesn't create a version + # or symlink to python3. Call python with the script directly since the + # shebang in the script won't work here. + execute_process( + COMMAND "python" "${PROJECT_SOURCE_DIR}/ci/collect-repo-info.py" "${ZEEK_INCLUDE_PLUGINS}" + WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" + OUTPUT_VARIABLE ZEEK_BUILD_INFO + RESULT_VARIABLE ZEEK_BUILD_INFO_RESULT + OUTPUT_STRIP_TRAILING_WHITESPACE) +else () + execute_process( + COMMAND "${PROJECT_SOURCE_DIR}/ci/collect-repo-info.py" "${ZEEK_INCLUDE_PLUGINS}" + WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" + OUTPUT_VARIABLE ZEEK_BUILD_INFO + RESULT_VARIABLE ZEEK_BUILD_INFO_RESULT + OUTPUT_STRIP_TRAILING_WHITESPACE) +endif () -if ( NOT ZEEK_BUILD_INFO_RESULT EQUAL "0" ) - message(FATAL_ERROR "Could not collect repository info") +if (NOT ZEEK_BUILD_INFO_RESULT EQUAL "0") + message(FATAL_ERROR "Could not collect repository info") endif () # string(JSON ... ) requires CMake 3.19, but then we could do something like: -# string(JSON ZEEK_BUILD_INFO SET "${ZEEK_BUILD_INFO}" -# compile_options cxx_flags "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${BuildType}}") +# string(JSON ZEEK_BUILD_INFO SET "${ZEEK_BUILD_INFO}" compile_options cxx_flags +# "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${BuildType}}") -######################################################################## -## Recurse on sub-directories +# ############################################################################## +# Recurse on sub-directories add_subdirectory(src) add_subdirectory(scripts) @@ -1277,30 +1247,30 @@ add_subdirectory(testing) include(CheckOptionalBuildSources) -CheckOptionalBuildSources(auxil/btest BTest INSTALL_BTEST) -CheckOptionalBuildSources(auxil/package-manager ZKG INSTALL_ZKG) -CheckOptionalBuildSources(auxil/zeekctl ZeekControl INSTALL_ZEEKCTL) -CheckOptionalBuildSources(auxil/zeek-aux Zeek-Aux INSTALL_AUX_TOOLS) -CheckOptionalBuildSources(auxil/zeek-archiver ZeekArchiver INSTALL_ZEEK_ARCHIVER) -CheckOptionalBuildSources(auxil/zeek-client ZeekClient INSTALL_ZEEK_CLIENT) +checkoptionalbuildsources(auxil/btest BTest INSTALL_BTEST) +checkoptionalbuildsources(auxil/package-manager ZKG INSTALL_ZKG) +checkoptionalbuildsources(auxil/zeekctl ZeekControl INSTALL_ZEEKCTL) +checkoptionalbuildsources(auxil/zeek-aux Zeek-Aux INSTALL_AUX_TOOLS) +checkoptionalbuildsources(auxil/zeek-archiver ZeekArchiver INSTALL_ZEEK_ARCHIVER) +checkoptionalbuildsources(auxil/zeek-client ZeekClient INSTALL_ZEEK_CLIENT) -if ( NOT DISABLE_SPICY ) - # The `zeek` binary implicitly depends on the driver object file built - # as part of `spicy`; make that dependency explicit. +if (NOT DISABLE_SPICY) + # The `zeek` binary implicitly depends on the driver object file built as part + # of `spicy`; make that dependency explicit. zeek_add_dependencies(spicyz) - if ( NOT SPICY_ROOT_DIR ) + if (NOT SPICY_ROOT_DIR) # Make sure we build targets of spicy-plugin after the `spicy` target. add_dependencies(plugin-Zeek-Spicy spicy) add_dependencies(spicyz spicy) - # Also install spicy-plugin's CMake files into Zeek's global `cmake/` folder. + # Also install spicy-plugin's CMake files into Zeek's global `cmake/` + # folder. # # NOTE: We do not install spicy-plugin's `FindZeek.cmake` since another # version of this file is already provided by Zeek. install(FILES auxil/spicy-plugin/cmake/ZeekSpicyAnalyzerSupport.cmake - auxil/spicy-plugin/cmake/FindSpicy.cmake - DESTINATION share/zeek/cmake) + auxil/spicy-plugin/cmake/FindSpicy.cmake DESTINATION share/zeek/cmake) endif () endif () @@ -1308,28 +1278,28 @@ endif () # scripts work in any build configuration. If we do not include Spicy these # files have no actual effect. # -# Spicy JIT relies on the path of the current executable to figure out -# whether it is run from a build or an install tree. This assumption -# gets broken for e.g., `spicyz` when running from the build tree -# (probably fixable), and also when JIT'ing directly from a `zeek` -# invocation (much harder to fix). Instead we generate shell -# definitions to support running and using Spicy or spicy-plugin -# functionality in the build tree, including JIT'ing directly from +# Spicy JIT relies on the path of the current executable to figure out whether +# it is run from a build or an install tree. This assumption gets broken for +# e.g., `spicyz` when running from the build tree (probably fixable), and also +# when JIT'ing directly from a `zeek` invocation (much harder to fix). Instead +# we generate shell definitions to support running and using Spicy or +# spicy-plugin functionality in the build tree, including JIT'ing directly from # Zeek. configure_file(${CMAKE_SOURCE_DIR}/auxil/spicy/spicy-path.in ${CMAKE_BINARY_DIR}/spicy-path @ONLY) -configure_file(${CMAKE_SOURCE_DIR}/auxil/spicy/hilti-cxx-include-dirs.in ${CMAKE_BINARY_DIR}/hilti-cxx-include-dirs @ONLY) +configure_file(${CMAKE_SOURCE_DIR}/auxil/spicy/hilti-cxx-include-dirs.in + ${CMAKE_BINARY_DIR}/hilti-cxx-include-dirs @ONLY) -######################################################################## -## Packaging Setup +# ############################################################################## +# Packaging Setup -if ( INSTALL_ZEEKCTL OR INSTALL_ZKG OR INSTALL_ZEEK_CLIENT ) +if (INSTALL_ZEEKCTL OR INSTALL_ZKG OR INSTALL_ZEEK_CLIENT) # CPack RPM Generator may not automatically detect this set(CPACK_RPM_PACKAGE_REQUIRES "python >= ${ZEEK_PYTHON_MIN}") endif () -# If this CMake project is a sub-project of another, we will not -# configure the generic packaging because CPack will fail in the case -# that the parent project has already configured packaging +# If this CMake project is a sub-project of another, we will not configure the +# generic packaging because CPack will fail in the case that the parent project +# has already configured packaging if ("${PROJECT_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}") include(ConfigurePackaging) ConfigurePackaging(${VERSION}) @@ -1338,22 +1308,18 @@ endif () # Refers back to the "distribution prefix". This is the source tree when # referring to Zeek from the build directory and the "share" directory under the # install preifx otherwise. -set(ZEEK_DIST_PREFIX - $ - $) +set(ZEEK_DIST_PREFIX $ + $) # Generate extra config file for the dynamic plugins. configure_file(src/ZeekPluginConfig.cmake.in ZeekPluginConfig.cmake @ONLY) # Write the CMake package and version files. configure_package_config_file( - "${CMAKE_CURRENT_SOURCE_DIR}/src/ZeekConfig.cmake.in" - "${CMAKE_CURRENT_BINARY_DIR}/ZeekConfig.cmake" - INSTALL_DESTINATION "${ZEEK_CMAKE_CONFIG_DIR}") -write_basic_package_version_file( - "${CMAKE_CURRENT_BINARY_DIR}/ZeekConfigVersion.cmake" - VERSION ${ZEEK_VERSION_NUMBER} - COMPATIBILITY ExactVersion) + "${CMAKE_CURRENT_SOURCE_DIR}/src/ZeekConfig.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/ZeekConfig.cmake" INSTALL_DESTINATION "${ZEEK_CMAKE_CONFIG_DIR}") +write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/ZeekConfigVersion.cmake" + VERSION ${ZEEK_VERSION_NUMBER} COMPATIBILITY ExactVersion) # Write the CMake targets file. export(EXPORT ZeekTargets FILE ZeekTargets.cmake NAMESPACE Zeek::) @@ -1363,66 +1329,63 @@ configure_file(src/ZeekPluginBootstrap.cmake.in ZeekPluginBootstrap.cmake @ONLY) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ZeekPluginBootstrap.cmake" DESTINATION "${ZEEK_CMAKE_CONFIG_DIR}") -install( - FILES - "${CMAKE_CURRENT_BINARY_DIR}/ZeekConfig.cmake" - "${CMAKE_CURRENT_BINARY_DIR}/ZeekConfigVersion.cmake" - DESTINATION - "${ZEEK_CMAKE_CONFIG_DIR}") +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ZeekConfig.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/ZeekConfigVersion.cmake" + DESTINATION "${ZEEK_CMAKE_CONFIG_DIR}") -install( - EXPORT ZeekTargets - DESTINATION "${ZEEK_CMAKE_CONFIG_DIR}" - NAMESPACE Zeek::) +install(EXPORT ZeekTargets DESTINATION "${ZEEK_CMAKE_CONFIG_DIR}" NAMESPACE Zeek::) -######################################################################## -## Build Summary +# ############################################################################## +# Build Summary if (CMAKE_BUILD_TYPE) string(TOUPPER ${CMAKE_BUILD_TYPE} BuildType) endif () -if ( INSTALL_BTEST_PCAPS ) +if (INSTALL_BTEST_PCAPS) set(_install_btest_tools_msg "all") else () set(_install_btest_tools_msg "no pcaps") endif () set(_binpac_exe_path "included") -if ( BINPAC_EXE_PATH ) +if (BINPAC_EXE_PATH) set(_binpac_exe_path ${BINPAC_EXE_PATH}) endif () set(_gen_zam_exe_path "included") -if ( GEN_ZAM_EXE_PATH ) +if (GEN_ZAM_EXE_PATH) set(_gen_zam_exe_path ${GEN_ZAM_EXE_PATH}) endif () set(_spicy "included") -if ( DISABLE_SPICY ) +if (DISABLE_SPICY) set(_spicy "disabled") -elseif ( SPICY_ROOT_DIR ) +elseif (SPICY_ROOT_DIR) set(_spicy "external (${SPICY_ROOT_DIR})") endif () -if ( DISABLE_SPICY ) +if (DISABLE_SPICY) set(_spicy_plugin "disabled") -elseif ( "${_spicy_plugin}" STREQUAL "" ) +elseif ("${_spicy_plugin}" STREQUAL "") set(_spicy_plugin "external (${SPICY_PLUGIN_PATH})") endif () -if ( ZEEK_LEGACY_ANALYZERS ) +if (ZEEK_LEGACY_ANALYZERS) list(JOIN ZEEK_LEGACY_ANALYZERS ", " _legacy_analyzers) - set(_legacy_analyzers "\n - Using unmaintained legacy analyzers for: ${_legacy_analyzers}") + set(_legacy_analyzers + "\n - Using unmaintained legacy analyzers for: ${_legacy_analyzers}") endif () -if ( ZEEK_SKIPPED_ANALYZERS ) +if (ZEEK_SKIPPED_ANALYZERS) list(JOIN ZEEK_SKIPPED_ANALYZERS ", " _skipped_analyzers) set(_skipped_analyzers "\n - Skipping analyzers: ${_skipped_analyzers}") endif () -if ( ZEEK_LEGACY_ANALYZERS OR ZEEK_SKIPPED_ANALYZERS ) - set(_analyzer_warning "\n\n[Warning] Some analyzers are not available due to lack of built-in Spicy support:${_legacy_analyzers}${_skipped_analyzers}") +if (ZEEK_LEGACY_ANALYZERS OR ZEEK_SKIPPED_ANALYZERS) + set(_analyzer_warning + "\n\n[Warning] Some analyzers are not available due to lack of built-in Spicy support:${_legacy_analyzers}${_skipped_analyzers}" + ) endif () message( @@ -1475,7 +1438,6 @@ message( "\nFuzz Engine: ${ZEEK_FUZZING_ENGINE}" "${_analyzer_warning}" "\n" - "\n================================================================\n" -) + "\n================================================================\n") include(UserChangedWarning) diff --git a/man/CMakeLists.txt b/man/CMakeLists.txt index 6a8a3d1bd9..48caa17846 100644 --- a/man/CMakeLists.txt +++ b/man/CMakeLists.txt @@ -1,5 +1,5 @@ - -install(DIRECTORY . DESTINATION ${ZEEK_MAN_INSTALL_PATH}/man8 FILES_MATCHING - PATTERN "*.8" -) - +install( + DIRECTORY . + DESTINATION ${ZEEK_MAN_INSTALL_PATH}/man8 + FILES_MATCHING + PATTERN "*.8") diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 168eba704b..313877f6e1 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -1,22 +1,22 @@ include(InstallPackageConfigFile) -install(DIRECTORY ./ DESTINATION ${ZEEK_SCRIPT_INSTALL_PATH} FILES_MATCHING - PATTERN "site/local*" EXCLUDE - PATTERN "*.zeek" - PATTERN "*.sig" - PATTERN "*.fp" -) +install( + DIRECTORY ./ + DESTINATION ${ZEEK_SCRIPT_INSTALL_PATH} + FILES_MATCHING + PATTERN "site/local*" EXCLUDE + PATTERN "*.zeek" + PATTERN "*.sig" + PATTERN "*.fp") -# Install local script as a config file since it's meant to be modified directly. -InstallPackageConfigFile( - ${CMAKE_CURRENT_SOURCE_DIR}/site/local.zeek - ${ZEEK_SCRIPT_INSTALL_PATH}/site - local.zeek) +# Install local script as a config file since it's meant to be modified +# directly. +InstallPackageConfigFile(${CMAKE_CURRENT_SOURCE_DIR}/site/local.zeek + ${ZEEK_SCRIPT_INSTALL_PATH}/site local.zeek) # Substitute values in templated script files, and install them. -configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/base/misc/installation.zeek.in - ${CMAKE_CURRENT_BINARY_DIR}/base/misc/installation.zeek @ONLY) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/base/misc/installation.zeek.in + ${CMAKE_CURRENT_BINARY_DIR}/base/misc/installation.zeek @ONLY) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/base/misc/installation.zeek - DESTINATION ${ZEEK_SCRIPT_INSTALL_PATH}/base/misc) + DESTINATION ${ZEEK_SCRIPT_INSTALL_PATH}/base/misc) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3a9621cc18..e76d0f6703 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,24 +1,16 @@ -include_directories(BEFORE - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/include - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_BINARY_DIR}/include -) +include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/include + ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/include) # Force creation of includes symlink. This can't just be in the src directory # because MSVC will end up with an include loop. -execute_process(COMMAND "${CMAKE_COMMAND}" -E make_directory - "${CMAKE_CURRENT_SOURCE_DIR}/include") -execute_process(COMMAND "${CMAKE_COMMAND}" -E create_symlink - ".." - "${CMAKE_CURRENT_SOURCE_DIR}/include/zeek") +execute_process(COMMAND "${CMAKE_COMMAND}" -E make_directory "${CMAKE_CURRENT_SOURCE_DIR}/include") +execute_process(COMMAND "${CMAKE_COMMAND}" -E create_symlink ".." + "${CMAKE_CURRENT_SOURCE_DIR}/include/zeek") # Allows header file inclusion via zeek/ within the build tree -execute_process(COMMAND "${CMAKE_COMMAND}" -E make_directory - "${CMAKE_CURRENT_BINARY_DIR}/include") -execute_process(COMMAND "${CMAKE_COMMAND}" -E create_symlink - ".." - "${CMAKE_CURRENT_BINARY_DIR}/include/zeek") +execute_process(COMMAND "${CMAKE_COMMAND}" -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/include") +execute_process(COMMAND "${CMAKE_COMMAND}" -E create_symlink ".." + "${CMAKE_CURRENT_BINARY_DIR}/include/zeek") # Poor man's JSON escaping as this is rendered into a C string. string(REPLACE "\"" "\\\"" ZEEK_BUILD_INFO_ESCAPED "${ZEEK_BUILD_INFO}") @@ -26,96 +18,85 @@ string(REPLACE "\n" "\\n" ZEEK_BUILD_INFO_ESCAPED "${ZEEK_BUILD_INFO_ESCAPED}") configure_file(version.c.in ${CMAKE_CURRENT_BINARY_DIR}/version.c) configure_file(util-config.h.in ${CMAKE_CURRENT_BINARY_DIR}/util-config.h) -# This creates a custom command to transform a bison output file (inFile) -# into outFile in order to avoid symbol conflicts: -# - replaces instances of 'yylex' in inFile with yylexPrefix -# - replaces instances of 'yy' in inFile with yyPrefix -# - deletes instances of 'extern char.*getenv' in inFile -# - writes results to outFile and adds it to list TRANSFORMED_BISON_OUTPUTS -macro(REPLACE_YY_PREFIX_TARGET inFile outFile yylexPrefix yyPrefix) +# This creates a custom command to transform a bison output file (inFile) into +# outFile in order to avoid symbol conflicts: - replaces instances of 'yylex' in +# inFile with yylexPrefix - replaces instances of 'yy' in inFile with yyPrefix - +# deletes instances of 'extern char.*getenv' in inFile - writes results to +# outFile and adds it to list TRANSFORMED_BISON_OUTPUTS +macro (REPLACE_YY_PREFIX_TARGET inFile outFile yylexPrefix yyPrefix) set(args "\"/extern char.*getenv/d") set(args "${args}\;s/yylex/${yylexPrefix}lex/") set(args "${args}\;s/yy/${yyPrefix}/g\"" < ${inFile} > ${outFile}) - add_custom_command(OUTPUT ${outFile} - COMMAND ${SED_EXE} - ARGS ${args} - DEPENDS ${inFile} - COMMENT "[sed] replacing stuff in ${inFile}" - ) + add_custom_command( + OUTPUT ${outFile} + COMMAND ${SED_EXE} ARGS ${args} + DEPENDS ${inFile} + COMMENT "[sed] replacing stuff in ${inFile}") list(APPEND TRANSFORMED_BISON_OUTPUTS ${outFile}) -endmacro(REPLACE_YY_PREFIX_TARGET) +endmacro (REPLACE_YY_PREFIX_TARGET) -######################################################################## -## Create targets to generate parser and scanner code +# ############################################################################## +# Create targets to generate parser and scanner code set(BISON_FLAGS "--debug") -if ( MSVC ) +if (MSVC) set(SIGN_COMPARE_FLAG "/wd4018") -else() +else () set(SIGN_COMPARE_FLAG "-Wno-sign-compare") -endif() +endif () # Rule parser/scanner -bison_target(RuleParser rule-parse.y - ${CMAKE_CURRENT_BINARY_DIR}/rup.cc - HEADER ${CMAKE_CURRENT_BINARY_DIR}/rup.h - #VERBOSE ${CMAKE_CURRENT_BINARY_DIR}/rule_parse.output - COMPILE_FLAGS "${BISON_FLAGS}") +bison_target( + RuleParser rule-parse.y ${CMAKE_CURRENT_BINARY_DIR}/rup.cc HEADER + ${CMAKE_CURRENT_BINARY_DIR}/rup.h + # VERBOSE ${CMAKE_CURRENT_BINARY_DIR}/rule_parse.output + COMPILE_FLAGS "${BISON_FLAGS}") replace_yy_prefix_target(${CMAKE_CURRENT_BINARY_DIR}/rup.cc - ${CMAKE_CURRENT_BINARY_DIR}/rule-parse.cc - rules_ rules_) -replace_yy_prefix_target(${CMAKE_CURRENT_BINARY_DIR}/rup.h - ${CMAKE_CURRENT_BINARY_DIR}/rule-parse.h + ${CMAKE_CURRENT_BINARY_DIR}/rule-parse.cc rules_ rules_) +replace_yy_prefix_target(${CMAKE_CURRENT_BINARY_DIR}/rup.h ${CMAKE_CURRENT_BINARY_DIR}/rule-parse.h rules_ rules_) flex_target(RuleScanner rule-scan.l ${CMAKE_CURRENT_BINARY_DIR}/rule-scan.cc COMPILE_FLAGS "-Prules_") set_property(SOURCE rule-scan.cc APPEND_STRING PROPERTY COMPILE_FLAGS "${SIGN_COMPARE_FLAG}") # RE parser/scanner -bison_target(REParser re-parse.y - ${CMAKE_CURRENT_BINARY_DIR}/rep.cc - HEADER ${CMAKE_CURRENT_BINARY_DIR}/re-parse.h - #VERBOSE ${CMAKE_CURRENT_BINARY_DIR}/re_parse.output - COMPILE_FLAGS "${BISON_FLAGS}") -replace_yy_prefix_target(${CMAKE_CURRENT_BINARY_DIR}/rep.cc - ${CMAKE_CURRENT_BINARY_DIR}/re-parse.cc +bison_target( + REParser re-parse.y ${CMAKE_CURRENT_BINARY_DIR}/rep.cc HEADER + ${CMAKE_CURRENT_BINARY_DIR}/re-parse.h + # VERBOSE ${CMAKE_CURRENT_BINARY_DIR}/re_parse.output + COMPILE_FLAGS "${BISON_FLAGS}") +replace_yy_prefix_target(${CMAKE_CURRENT_BINARY_DIR}/rep.cc ${CMAKE_CURRENT_BINARY_DIR}/re-parse.cc re_ RE_) -flex_target(REScanner re-scan.l ${CMAKE_CURRENT_BINARY_DIR}/re-scan.cc - COMPILE_FLAGS "-Pre_") +flex_target(REScanner re-scan.l ${CMAKE_CURRENT_BINARY_DIR}/re-scan.cc COMPILE_FLAGS "-Pre_") add_flex_bison_dependency(REScanner REParser) set_property(SOURCE re-scan.cc APPEND_STRING PROPERTY COMPILE_FLAGS "${SIGN_COMPARE_FLAG}") # Parser/Scanner -bison_target(Parser parse.y - ${CMAKE_CURRENT_BINARY_DIR}/p.cc - HEADER ${CMAKE_CURRENT_BINARY_DIR}/zeekparse.h - #VERBOSE ${CMAKE_CURRENT_BINARY_DIR}/parse.output - COMPILE_FLAGS "${BISON_FLAGS}") -replace_yy_prefix_target(${CMAKE_CURRENT_BINARY_DIR}/p.cc - ${CMAKE_CURRENT_BINARY_DIR}/parse.cc - zeek yy) -flex_target(Scanner scan.l ${CMAKE_CURRENT_BINARY_DIR}/scan.cc - COMPILE_FLAGS "-Pzeek") +bison_target( + Parser parse.y ${CMAKE_CURRENT_BINARY_DIR}/p.cc HEADER ${CMAKE_CURRENT_BINARY_DIR}/zeekparse.h + # VERBOSE ${CMAKE_CURRENT_BINARY_DIR}/parse.output + COMPILE_FLAGS "${BISON_FLAGS}") +replace_yy_prefix_target(${CMAKE_CURRENT_BINARY_DIR}/p.cc ${CMAKE_CURRENT_BINARY_DIR}/parse.cc zeek + yy) +flex_target(Scanner scan.l ${CMAKE_CURRENT_BINARY_DIR}/scan.cc COMPILE_FLAGS "-Pzeek") set_property(SOURCE scan.cc APPEND_STRING PROPERTY COMPILE_FLAGS "${SIGN_COMPARE_FLAG}") # Add a dependency for the generated files to zeek_autogen_files. add_custom_target( zeek_bison_outputs - DEPENDS - ${CMAKE_CURRENT_BINARY_DIR}/parse.cc - ${CMAKE_CURRENT_BINARY_DIR}/re-parse.cc - ${CMAKE_CURRENT_BINARY_DIR}/re-parse.h - ${CMAKE_CURRENT_BINARY_DIR}/re-scan.cc - ${CMAKE_CURRENT_BINARY_DIR}/rule-parse.cc - ${CMAKE_CURRENT_BINARY_DIR}/rule-parse.h - ${CMAKE_CURRENT_BINARY_DIR}/rule-scan.cc - ${CMAKE_CURRENT_BINARY_DIR}/scan.cc -) + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/parse.cc + ${CMAKE_CURRENT_BINARY_DIR}/re-parse.cc + ${CMAKE_CURRENT_BINARY_DIR}/re-parse.h + ${CMAKE_CURRENT_BINARY_DIR}/re-scan.cc + ${CMAKE_CURRENT_BINARY_DIR}/rule-parse.cc + ${CMAKE_CURRENT_BINARY_DIR}/rule-parse.h + ${CMAKE_CURRENT_BINARY_DIR}/rule-scan.cc + ${CMAKE_CURRENT_BINARY_DIR}/scan.cc) add_dependencies(zeek_autogen_files zeek_bison_outputs) -######################################################################## -## bifcl-dependent targets +# ############################################################################## +# bifcl-dependent targets include(BifCl) @@ -131,34 +112,30 @@ set(BIF_SRCS strings.bif reporter.bif option.bif - # Note: the supervisor BIF file is treated like other top-level BIFs - # instead of contained in its own subdirectory CMake logic because - # subdirectory BIFs are treated differently and don't support being called - # *during* parsing (e.g. within an @if directive). + # Note: the supervisor BIF file is treated like other top-level BIFs instead + # of contained in its own subdirectory CMake logic because subdirectory BIFs + # are treated differently and don't support being called *during* parsing + # (e.g. within an @if directive). supervisor/supervisor.bif - # The packet analysis BIF is treated like other top-level BIFs because - # it's needed before parsing the packet protocol scripts, which happen - # very near to the start of parsing. + # The packet analysis BIF is treated like other top-level BIFs because it's + # needed before parsing the packet protocol scripts, which happen very near + # to the start of parsing. packet_analysis/packet_analysis.bif - # The C++ loading BIF is treated like other top-level BIFs to give - # us flexibility regarding when it's called. - script_opt/CPP/CPP-load.bif -) + # The C++ loading BIF is treated like other top-level BIFs to give us + # flexibility regarding when it's called. + script_opt/CPP/CPP-load.bif) foreach (bift ${BIF_SRCS}) bif_target(${bift} "standard") endforeach () -######################################################################## -## BinPAC-dependent targets +# ############################################################################## +# BinPAC-dependent targets include(BinPAC) -set(BINPAC_AUXSRC - ${CMAKE_CURRENT_SOURCE_DIR}/binpac.pac - ${CMAKE_CURRENT_SOURCE_DIR}/zeek.pac - ${CMAKE_CURRENT_SOURCE_DIR}/binpac_zeek.h -) +set(BINPAC_AUXSRC ${CMAKE_CURRENT_SOURCE_DIR}/binpac.pac ${CMAKE_CURRENT_SOURCE_DIR}/zeek.pac + ${CMAKE_CURRENT_SOURCE_DIR}/binpac_zeek.h) set(BINPAC_OUTPUTS "") @@ -168,8 +145,8 @@ list(APPEND BINPAC_OUTPUTS "${BINPAC_OUTPUT_CC}") binpac_target(binpac_zeek-lib.pac) list(APPEND BINPAC_OUTPUTS "${BINPAC_OUTPUT_CC}") -######################################################################## -## Gen-ZAM setup +# ############################################################################## +# Gen-ZAM setup include(Gen-ZAM) @@ -177,9 +154,9 @@ set(GEN_ZAM_SRC ${CMAKE_CURRENT_SOURCE_DIR}/script_opt/ZAM/Ops.in) gen_zam_target(${GEN_ZAM_SRC}) -######################################################################## -## Including subdirectories. -######################################################################## +# ############################################################################## +# Including subdirectories. +# ############################################################################## option(USE_SQLITE "Should Zeek use SQLite?" ON) @@ -195,8 +172,8 @@ add_subdirectory(logging) add_subdirectory(probabilistic) add_subdirectory(session) -######################################################################## -## Build in the discovered external plugins and create the autogenerated scripts. +# ############################################################################## +# Build in the discovered external plugins and create the autogenerated scripts. set(PRELOAD_SCRIPT ${PROJECT_BINARY_DIR}/scripts/builtin-plugins/__preload__.zeek) file(WRITE ${PRELOAD_SCRIPT} "# Warning, this is an autogenerated file!\n") @@ -204,14 +181,14 @@ set(LOAD_SCRIPT ${PROJECT_BINARY_DIR}/scripts/builtin-plugins/__load__.zeek) file(WRITE ${LOAD_SCRIPT} "# Warning, this is an autogenerated file!\n") # TODO: this really should be a function to make sure we have an isolated scope. -# However, for historic reasons, we're not doing that yet. Some plugin -# modify global state such as `zeekdeps`. -macro(add_extra_builtin_plugin plugin_dir) +# However, for historic reasons, we're not doing that yet. Some plugin modify +# global state such as `zeekdeps`. +macro (add_extra_builtin_plugin plugin_dir) get_filename_component(plugin_name "${plugin_dir}" NAME) - if(IS_DIRECTORY "${plugin_dir}/cmake") + if (IS_DIRECTORY "${plugin_dir}/cmake") list(APPEND CMAKE_MODULE_PATH "${plugin_dir}/cmake") - endif() + endif () # Set this flag so that ZeekPluginStatic.cmake knows that this plugin is not # from our source tree but from an external source (or git submodule). This @@ -222,36 +199,36 @@ macro(add_extra_builtin_plugin plugin_dir) # TODO: drop once we turn this into a function. set(ZEEK_BUILDING_EXTRA_PLUGINS OFF) -endmacro() +endmacro () foreach (plugin_dir ${BUILTIN_PLUGIN_LIST}) add_extra_builtin_plugin("${plugin_dir}") -endforeach() +endforeach () install(FILES ${PRELOAD_SCRIPT} DESTINATION ${ZEEK_SCRIPT_INSTALL_PATH}/builtin-plugins/) install(FILES ${LOAD_SCRIPT} DESTINATION ${ZEEK_SCRIPT_INSTALL_PATH}/builtin-plugins/) -######################################################################## -## This has to happen after the parts for builtin plugins, or else -## symbols are missing when it goes to link the fuzzer binaries. +# ############################################################################## +# This has to happen after the parts for builtin plugins, or else symbols are +# missing when it goes to link the fuzzer binaries. add_subdirectory(fuzzers) -######################################################################## -## zeek target +# ############################################################################## +# zeek target -find_package (Threads) +find_package(Threads) # Avoid CMake warning about "3rdparty" looking like a number. cmake_policy(PUSH) if (POLICY CMP0012) -cmake_policy(SET CMP0012 NEW) + cmake_policy(SET CMP0012 NEW) endif () -# This macro stores associated headers for any C/C++ source files given -# as arguments (past _var) as a list in the CMake variable named "_var". -macro(COLLECT_HEADERS _var) +# This macro stores associated headers for any C/C++ source files given as +# arguments (past _var) as a list in the CMake variable named "_var". +macro (COLLECT_HEADERS _var) foreach (src ${ARGN}) get_filename_component(ext ${src} EXT) if ("${ext}" STREQUAL ".cc" OR "${ext}" STREQUAL ".c") @@ -266,39 +243,34 @@ macro(COLLECT_HEADERS _var) endif () endif () endforeach () -endmacro(COLLECT_HEADERS _var) +endmacro (COLLECT_HEADERS _var) cmake_policy(POP) -# define a command that's used to run the make_dbg_constants.py script -# building the zeek binary depends on the outputs of this script -add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/DebugCmdConstants.h - ${CMAKE_CURRENT_BINARY_DIR}/DebugCmdInfoConstants.cc - COMMAND ${PYTHON_EXECUTABLE} - ARGS ${CMAKE_CURRENT_SOURCE_DIR}/make_dbg_constants.py - ${CMAKE_CURRENT_SOURCE_DIR}/DebugCmdInfoConstants.in - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/make_dbg_constants.py - ${CMAKE_CURRENT_SOURCE_DIR}/DebugCmdInfoConstants.in - COMMENT "[Python] Processing debug commands" - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} -) +# define a command that's used to run the make_dbg_constants.py script building +# the zeek binary depends on the outputs of this script +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/DebugCmdConstants.h + ${CMAKE_CURRENT_BINARY_DIR}/DebugCmdInfoConstants.cc + COMMAND ${PYTHON_EXECUTABLE} ARGS ${CMAKE_CURRENT_SOURCE_DIR}/make_dbg_constants.py + ${CMAKE_CURRENT_SOURCE_DIR}/DebugCmdInfoConstants.in + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/make_dbg_constants.py + ${CMAKE_CURRENT_SOURCE_DIR}/DebugCmdInfoConstants.in + COMMENT "[Python] Processing debug commands" + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) -add_custom_target( - zeek_debugcmd_gen - DEPENDS - ${CMAKE_CURRENT_BINARY_DIR}/DebugCmdConstants.h - ${CMAKE_CURRENT_BINARY_DIR}/DebugCmdInfoConstants.cc -) +add_custom_target(zeek_debugcmd_gen DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/DebugCmdConstants.h + ${CMAKE_CURRENT_BINARY_DIR}/DebugCmdInfoConstants.cc) add_dependencies(zeek_autogen_files zeek_debugcmd_gen) set(_gen_zeek_script_cpp ${CMAKE_CURRENT_BINARY_DIR}/../CPP-gen.cc) -add_custom_command(OUTPUT ${_gen_zeek_script_cpp} - COMMAND ${CMAKE_COMMAND} -E touch ${_gen_zeek_script_cpp}) +add_custom_command(OUTPUT ${_gen_zeek_script_cpp} COMMAND ${CMAKE_COMMAND} -E touch + ${_gen_zeek_script_cpp}) if (!MSVC) set_source_files_properties(legacy-netvar-init.cc PROPERTIES COMPILE_FLAGS - -Wno-deprecated-declarations) -endif() + -Wno-deprecated-declarations) +endif () set(MAIN_SRCS digest.cc @@ -386,9 +358,7 @@ set(MAIN_SRCS ZeekArgs.cc ZeekString.cc ZVal.cc - ${SUPERVISOR_SRCS} - threading/BasicThread.cc threading/Formatter.cc threading/Manager.cc @@ -396,12 +366,10 @@ set(MAIN_SRCS threading/SerialTypes.cc threading/formatters/Ascii.cc threading/formatters/JSON.cc - plugin/Component.cc plugin/ComponentManager.h plugin/Manager.cc plugin/Plugin.cc - script_opt/CPP/Attrs.cc script_opt/CPP/Consts.cc script_opt/CPP/DeclFunc.cc @@ -421,9 +389,7 @@ set(MAIN_SRCS script_opt/CPP/Types.cc script_opt/CPP/Util.cc script_opt/CPP/Vars.cc - ${_gen_zeek_script_cpp} - script_opt/Expr.cc script_opt/GenIDDefs.cc script_opt/IDOptInfo.cc @@ -435,7 +401,6 @@ set(MAIN_SRCS script_opt/TempVar.cc script_opt/UsageAnalyzer.cc script_opt/UseDefs.cc - script_opt/ZAM/AM-Opt.cc script_opt/ZAM/Branches.cc script_opt/ZAM/BuiltIn.cc @@ -450,9 +415,7 @@ set(MAIN_SRCS script_opt/ZAM/ZBody.cc script_opt/ZAM/ZInst.cc script_opt/ZAM/ZOp.cc - - digest.h -) + digest.h) set(THIRD_PARTY_SRCS 3rdparty/bro_inet_ntop.c # Remove in v6.1. @@ -464,69 +427,58 @@ set(THIRD_PARTY_SRCS 3rdparty/patricia.c 3rdparty/setsignal.c $<$:3rdparty/sqlite3.c> - 3rdparty/strsep.c -) + 3rdparty/strsep.c) -# Highwayhash. Highwayhash is a bit special since it has architecture dependent code... +# Highwayhash. Highwayhash is a bit special since it has architecture dependent +# code... set(hhash_dir ${PROJECT_SOURCE_DIR}/auxil/highwayhash/highwayhash) zeek_add_subdir_library( hhash SOURCES - ${hhash_dir}/sip_hash.cc - ${hhash_dir}/sip_tree_hash.cc - ${hhash_dir}/scalar_sip_tree_hash.cc - ${hhash_dir}/arch_specific.cc - ${hhash_dir}/instruction_sets.cc - ${hhash_dir}/nanobenchmark.cc - ${hhash_dir}/os_specific.cc - ${hhash_dir}/hh_portable.cc -) + ${hhash_dir}/sip_hash.cc + ${hhash_dir}/sip_tree_hash.cc + ${hhash_dir}/scalar_sip_tree_hash.cc + ${hhash_dir}/arch_specific.cc + ${hhash_dir}/instruction_sets.cc + ${hhash_dir}/nanobenchmark.cc + ${hhash_dir}/os_specific.cc + ${hhash_dir}/hh_portable.cc) if (${COMPILER_ARCHITECTURE} STREQUAL "arm") - check_c_source_compiles(" + check_c_source_compiles( + " #if defined(__ARM_NEON__) || defined(__ARM_NEON) int main() { return 0; } #else #error #endif - " test_arm_neon) + " + test_arm_neon) - if (test_arm_neon) - target_sources(zeek_hhash_obj PRIVATE ${hhash_dir}/hh_neon.cc) - endif () + if (test_arm_neon) + target_sources(zeek_hhash_obj PRIVATE ${hhash_dir}/hh_neon.cc) + endif () - target_compile_options( - zeek_hhash_obj - PRIVATE - -mfloat-abi=hard - -march=armv7-a - -mfpu=neon - ) + target_compile_options(zeek_hhash_obj PRIVATE -mfloat-abi=hard -march=armv7-a -mfpu=neon) elseif (${COMPILER_ARCHITECTURE} STREQUAL "aarch64") - target_sources(zeek_hhash_obj PRIVATE ${hhash_dir}/hh_neon.cc) + target_sources(zeek_hhash_obj PRIVATE ${hhash_dir}/hh_neon.cc) elseif (${COMPILER_ARCHITECTURE} STREQUAL "power") - target_sources(zeek_hhash_obj PRIVATE ${hhash_dir}/hh_vsx.cc) - set_source_files_properties(${hhash_dir}/hh_vsx.cc PROPERTIES COMPILE_FLAGS - -mvsx) -elseif(${COMPILER_ARCHITECTURE} STREQUAL "x86_64") - target_sources( - zeek_hhash_obj - PRIVATE - ${hhash_dir}/hh_avx2.cc - ${hhash_dir}/hh_sse41.cc) - if (MSVC) - set(_avx_flag /arch:AVX2) - # Using an undocumentd compiler flag: https://stackoverflow.com/questions/64053597/how-do-i-enable-sse4-1-and-sse3-but-not-avx-in-msvc/69328426#69328426 - set(_sse_flag /d2archSSE42) - else() - set(_avx_flag -mavx2) - set(_sse_flag -msse4.1) - endif() + target_sources(zeek_hhash_obj PRIVATE ${hhash_dir}/hh_vsx.cc) + set_source_files_properties(${hhash_dir}/hh_vsx.cc PROPERTIES COMPILE_FLAGS -mvsx) +elseif (${COMPILER_ARCHITECTURE} STREQUAL "x86_64") + target_sources(zeek_hhash_obj PRIVATE ${hhash_dir}/hh_avx2.cc ${hhash_dir}/hh_sse41.cc) + if (MSVC) + set(_avx_flag /arch:AVX2) + # Using an undocumentd compiler flag: + # https://stackoverflow.com/questions/64053597/how-do-i-enable-sse4-1-and-sse3-but-not-avx-in-msvc/69328426#69328426 + set(_sse_flag /d2archSSE42) + else () + set(_avx_flag -mavx2) + set(_sse_flag -msse4.1) + endif () - set_source_files_properties(${hhash_dir}/hh_avx2.cc PROPERTIES COMPILE_FLAGS - ${_avx_flag}) - set_source_files_properties(${hhash_dir}/hh_sse41.cc PROPERTIES COMPILE_FLAGS - ${_sse_flag}) + set_source_files_properties(${hhash_dir}/hh_avx2.cc PROPERTIES COMPILE_FLAGS ${_avx_flag}) + set_source_files_properties(${hhash_dir}/hh_sse41.cc PROPERTIES COMPILE_FLAGS ${_sse_flag}) endif () set(zeek_SRCS @@ -550,8 +502,7 @@ set(zeek_SRCS ${CMAKE_CURRENT_BINARY_DIR}/ZAM-MethodDecls.h ${THIRD_PARTY_SRCS} ${HH_SRCS} - ${MAIN_SRCS} -) + ${MAIN_SRCS}) collect_headers(zeek_HEADERS ${zeek_SRCS}) @@ -564,35 +515,31 @@ zeek_target_link_libraries(zeek_objs) if (TARGET zeek_exe) target_sources(zeek_exe PRIVATE main.cc ${zeek_HEADERS}) - # npcap/winpcap need to be loaded in delayed mode so that we can set the load path - # correctly at runtime. See https://npcap.com/guide/npcap-devguide.html#npcap-feature-native - # for why this is necessary. - if ( MSVC AND HAVE_WPCAP ) + # npcap/winpcap need to be loaded in delayed mode so that we can set the load + # path correctly at runtime. See + # https://npcap.com/guide/npcap-devguide.html#npcap-feature-native for why + # this is necessary. + if (MSVC AND HAVE_WPCAP) set(zeekdeps ${zeekdeps} delayimp.lib) set_target_properties(zeek_exe PROPERTIES LINK_FLAGS "/DELAYLOAD:wpcap.dll") - endif() + endif () target_link_libraries(zeek_exe PRIVATE ${zeekdeps} ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS}) # Export symbols from zeek executable for use by plugins set_target_properties(zeek_exe PROPERTIES ENABLE_EXPORTS TRUE) - if ( MSVC ) + if (MSVC) set(WINDOWS_EXPORT_ALL_SYMBOLS ON) endif () -endif() +endif () if (TARGET zeek_lib) target_sources(zeek_lib PRIVATE ${zeek_HEADERS}) - target_link_libraries( - zeek_lib - PUBLIC - ${zeekdeps} - ${CMAKE_THREAD_LIBS_INIT} - ${CMAKE_DL_LIBS}) -endif() + target_link_libraries(zeek_lib PUBLIC ${zeekdeps} ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS}) +endif () zeek_include_directories( ${CMAKE_BINARY_DIR} @@ -601,21 +548,23 @@ zeek_include_directories( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/zeek/src - ${CMAKE_SOURCE_DIR}/zeek/src/include -) + ${CMAKE_SOURCE_DIR}/zeek/src/include) # Install *.bif.zeek. -install(DIRECTORY ${PROJECT_BINARY_DIR}/scripts/base/bif DESTINATION ${ZEEK_SCRIPT_INSTALL_PATH}/base) +install(DIRECTORY ${PROJECT_BINARY_DIR}/scripts/base/bif + DESTINATION ${ZEEK_SCRIPT_INSTALL_PATH}/base) # Create plugin directory at install time. install(DIRECTORY DESTINATION ${ZEEK_PLUGIN_DIR}) # Make clean removes the bif directory. -set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${PROJECT_BINARY_DIR}/scripts/base/bif) +set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES + ${PROJECT_BINARY_DIR}/scripts/base/bif) -# Remove some stale files and scripts that previous Zeek versions put in -# place, yet make confuse us now. This makes upgrading easier. -install(CODE " +# Remove some stale files and scripts that previous Zeek versions put in place, +# yet make confuse us now. This makes upgrading easier. +install( + CODE " file(REMOVE_RECURSE ${ZEEK_SCRIPT_INSTALL_PATH}/base/frameworks/logging/writers/dataseries.bro ${ZEEK_SCRIPT_INSTALL_PATH}/base/frameworks/logging/writers/elasticsearch.bro @@ -623,60 +572,59 @@ install(CODE " ) ") -# Make sure to escape a bunch of special characters in the path before trying to use it as a -# regular expression below. -string(REGEX REPLACE "([][+.*()^])" "\\\\\\1" escaped_include_path "${CMAKE_CURRENT_SOURCE_DIR}/include/*") +# Make sure to escape a bunch of special characters in the path before trying to +# use it as a regular expression below. +string(REGEX REPLACE "([][+.*()^])" "\\\\\\1" escaped_include_path + "${CMAKE_CURRENT_SOURCE_DIR}/include/*") if (WIN32) - install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/windows/usr.include/ - DESTINATION include/ - FILES_MATCHING - PATTERN "*.h" - ) -endif() - -install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ - DESTINATION include/zeek + install( + DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/windows/usr.include/ + DESTINATION include/ FILES_MATCHING - PATTERN "*.h" - PATTERN "*.pac" - PATTERN "3rdparty/*" EXCLUDE - # The "zeek -> ." symlink isn't needed in the install-tree - REGEX "${escaped_include_path}$" EXCLUDE + PATTERN "*.h") +endif () - # FILES_MATCHING creates empty directories: - # https://gitlab.kitware.com/cmake/cmake/-/issues/17122 - # Exclude the ones that this affects explicitly. - PATTERN "script_opt/CPP/maint" EXCLUDE - PATTERN "fuzzers/corpora" EXCLUDE -) +install( + DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ + DESTINATION include/zeek + FILES_MATCHING + PATTERN "*.h" + PATTERN "*.pac" + PATTERN "3rdparty/*" EXCLUDE + # The "zeek -> ." symlink isn't needed in the install-tree + REGEX "${escaped_include_path}$" EXCLUDE + # FILES_MATCHING creates empty directories: + # https://gitlab.kitware.com/cmake/cmake/-/issues/17122 Exclude the ones that + # this affects explicitly. + PATTERN "script_opt/CPP/maint" EXCLUDE + PATTERN "fuzzers/corpora" EXCLUDE) -install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ - DESTINATION include/zeek - FILES_MATCHING - PATTERN "*.bif.func_h" - PATTERN "*.bif.netvar_h" - PATTERN "*.bif.h" - PATTERN "CMakeFiles" EXCLUDE - # The "include/zeek -> .." symlink isn't needed in the install-tree - REGEX "${escaped_include_path}$" EXCLUDE -) +install( + DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ + DESTINATION include/zeek + FILES_MATCHING + PATTERN "*.bif.func_h" + PATTERN "*.bif.netvar_h" + PATTERN "*.bif.h" + PATTERN "CMakeFiles" EXCLUDE + # The "include/zeek -> .." symlink isn't needed in the install-tree + REGEX "${escaped_include_path}$" EXCLUDE) -install(FILES - ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/ConvertUTF.h - ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/bro_inet_ntop.h # Remove in v6.1 - ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/zeek_inet_ntop.h - ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/bsd-getopt-long.h - ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/modp_numtoa.h - ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/patricia.h - ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/setsignal.h - $<$:${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/sqlite3.h> - ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/doctest.h - DESTINATION include/zeek/3rdparty -) +install( + FILES ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/ConvertUTF.h + ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/bro_inet_ntop.h # Remove in v6.1 + ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/zeek_inet_ntop.h + ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/bsd-getopt-long.h + ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/modp_numtoa.h + ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/patricia.h + ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/setsignal.h + $<$:${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/sqlite3.h> + ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/doctest.h + DESTINATION include/zeek/3rdparty) -######################################################################## -## Clang-tidy target now that we have all of the sources +# ############################################################################## +# Clang-tidy target now that we have all of the sources add_clang_tidy_files(${MAIN_SRCS}) @@ -685,23 +633,22 @@ add_clang_tidy_files(${MAIN_SRCS}) # *.bif.register.cc) create_clang_tidy_target() -######################################################################## -## CTest setup. +# ############################################################################## +# CTest setup. # Scan all .cc files for TEST_CASE macros and generate CTest targets. if (ENABLE_ZEEK_UNIT_TESTS) set(test_cases "") foreach (cc_file ${TIDY_SRCS}) - file (STRINGS ${cc_file} test_case_lines REGEX "TEST_CASE") + file(STRINGS ${cc_file} test_case_lines REGEX "TEST_CASE") foreach (line ${test_case_lines}) string(REGEX REPLACE "TEST_CASE\\(\"(.+)\"\\)" "\\1" test_case "${line}") list(APPEND test_cases "${test_case}") endforeach () endforeach () list(LENGTH test_cases num_test_cases) - MESSAGE(STATUS "-- Found ${num_test_cases} test cases for CTest") + message(STATUS "-- Found ${num_test_cases} test cases for CTest") foreach (test_case ${test_cases}) - add_test(NAME "\"${test_case}\"" - COMMAND zeek --test "--test-case=${test_case}") + add_test(NAME "\"${test_case}\"" COMMAND zeek --test "--test-case=${test_case}") endforeach () endif () diff --git a/src/analyzer/CMakeLists.txt b/src/analyzer/CMakeLists.txt index 496de66d32..ca901c3771 100644 --- a/src/analyzer/CMakeLists.txt +++ b/src/analyzer/CMakeLists.txt @@ -1,12 +1,14 @@ zeek_add_subdir_library( analyzer - INTERNAL_DEPENDENCIES ${BIF_BUILD_TARGET} - INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} + INTERNAL_DEPENDENCIES + ${BIF_BUILD_TARGET} + INCLUDE_DIRS + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} SOURCES - Analyzer.cc - Component.cc - Manager.cc -) + Analyzer.cc + Component.cc + Manager.cc) # Treat BIFs as builtin (alternative mode). bif_target(analyzer.bif) diff --git a/src/analyzer/protocol/bittorrent/CMakeLists.txt b/src/analyzer/protocol/bittorrent/CMakeLists.txt index 2881d8339f..9c663bc3d0 100644 --- a/src/analyzer/protocol/bittorrent/CMakeLists.txt +++ b/src/analyzer/protocol/bittorrent/CMakeLists.txt @@ -2,13 +2,12 @@ zeek_add_plugin( Zeek BitTorrent SOURCES - BitTorrent.cc - BitTorrentTracker.cc - Plugin.cc + BitTorrent.cc + BitTorrentTracker.cc + Plugin.cc BIFS - events.bif + events.bif PAC - bittorrent.pac - bittorrent-analyzer.pac - bittorrent-protocol.pac -) + bittorrent.pac + bittorrent-analyzer.pac + bittorrent-protocol.pac) diff --git a/src/analyzer/protocol/conn-size/CMakeLists.txt b/src/analyzer/protocol/conn-size/CMakeLists.txt index 5ed096d5c3..6780316ab5 100644 --- a/src/analyzer/protocol/conn-size/CMakeLists.txt +++ b/src/analyzer/protocol/conn-size/CMakeLists.txt @@ -2,9 +2,8 @@ zeek_add_plugin( Zeek ConnSize SOURCES - ConnSize.cc - Plugin.cc + ConnSize.cc + Plugin.cc BIFS - events.bif - functions.bif -) + events.bif + functions.bif) diff --git a/src/analyzer/protocol/dce-rpc/CMakeLists.txt b/src/analyzer/protocol/dce-rpc/CMakeLists.txt index 39cb498b6e..34b3f95ba8 100644 --- a/src/analyzer/protocol/dce-rpc/CMakeLists.txt +++ b/src/analyzer/protocol/dce-rpc/CMakeLists.txt @@ -2,17 +2,16 @@ zeek_add_plugin( Zeek DCE_RPC SOURCES - DCE_RPC.cc - Plugin.cc + DCE_RPC.cc + Plugin.cc BIFS - consts.bif - types.bif - events.bif + consts.bif + types.bif + events.bif PAC - dce_rpc.pac - dce_rpc-protocol.pac - dce_rpc-analyzer.pac - dce_rpc-auth.pac - endpoint-atsvc.pac - endpoint-epmapper.pac -) + dce_rpc.pac + dce_rpc-protocol.pac + dce_rpc-analyzer.pac + dce_rpc-auth.pac + endpoint-atsvc.pac + endpoint-epmapper.pac) diff --git a/src/analyzer/protocol/dhcp/CMakeLists.txt b/src/analyzer/protocol/dhcp/CMakeLists.txt index 2964060d82..c6623b56f0 100644 --- a/src/analyzer/protocol/dhcp/CMakeLists.txt +++ b/src/analyzer/protocol/dhcp/CMakeLists.txt @@ -2,14 +2,13 @@ zeek_add_plugin( Zeek DHCP SOURCES - DHCP.cc - Plugin.cc + DHCP.cc + Plugin.cc BIFS - events.bif - types.bif + events.bif + types.bif PAC - dhcp.pac - dhcp-protocol.pac - dhcp-analyzer.pac - dhcp-options.pac -) + dhcp.pac + dhcp-protocol.pac + dhcp-analyzer.pac + dhcp-options.pac) diff --git a/src/analyzer/protocol/dnp3/CMakeLists.txt b/src/analyzer/protocol/dnp3/CMakeLists.txt index be084cf874..dd647498f8 100644 --- a/src/analyzer/protocol/dnp3/CMakeLists.txt +++ b/src/analyzer/protocol/dnp3/CMakeLists.txt @@ -2,13 +2,12 @@ zeek_add_plugin( Zeek DNP3 SOURCES - DNP3.cc - Plugin.cc + DNP3.cc + Plugin.cc BIFS - events.bif + events.bif PAC - dnp3.pac - dnp3-analyzer.pac - dnp3-protocol.pac - dnp3-objects.pac -) + dnp3.pac + dnp3-analyzer.pac + dnp3-protocol.pac + dnp3-objects.pac) diff --git a/src/analyzer/protocol/dns/CMakeLists.txt b/src/analyzer/protocol/dns/CMakeLists.txt index 8e6a9c8a93..7fbeec5e1e 100644 --- a/src/analyzer/protocol/dns/CMakeLists.txt +++ b/src/analyzer/protocol/dns/CMakeLists.txt @@ -2,8 +2,7 @@ zeek_add_plugin( Zeek DNS SOURCES - DNS.cc - Plugin.cc + DNS.cc + Plugin.cc BIFS - events.bif -) + events.bif) diff --git a/src/analyzer/protocol/file/CMakeLists.txt b/src/analyzer/protocol/file/CMakeLists.txt index 5408b1851c..ae574880cf 100644 --- a/src/analyzer/protocol/file/CMakeLists.txt +++ b/src/analyzer/protocol/file/CMakeLists.txt @@ -2,8 +2,7 @@ zeek_add_plugin( Zeek File SOURCES - File.cc - Plugin.cc + File.cc + Plugin.cc BIFS - events.bif -) + events.bif) diff --git a/src/analyzer/protocol/finger/CMakeLists.txt b/src/analyzer/protocol/finger/CMakeLists.txt index 056a5f93e2..39174c03c5 100644 --- a/src/analyzer/protocol/finger/CMakeLists.txt +++ b/src/analyzer/protocol/finger/CMakeLists.txt @@ -1,9 +1,8 @@ spicy_add_analyzer( - NAME + NAME Finger - SOURCES + SOURCES finger.spicy finger.evt - LEGACY - legacy -) + LEGACY + legacy) diff --git a/src/analyzer/protocol/finger/legacy/CMakeLists.txt b/src/analyzer/protocol/finger/legacy/CMakeLists.txt index 6f006489bd..3ad97bd66b 100644 --- a/src/analyzer/protocol/finger/legacy/CMakeLists.txt +++ b/src/analyzer/protocol/finger/legacy/CMakeLists.txt @@ -2,8 +2,7 @@ zeek_add_plugin( Zeek Finger SOURCES - Finger.cc - Plugin.cc + Finger.cc + Plugin.cc BIFS - events.bif -) + events.bif) diff --git a/src/analyzer/protocol/ftp/CMakeLists.txt b/src/analyzer/protocol/ftp/CMakeLists.txt index 3420c4eb5f..728c5ddc65 100644 --- a/src/analyzer/protocol/ftp/CMakeLists.txt +++ b/src/analyzer/protocol/ftp/CMakeLists.txt @@ -2,9 +2,8 @@ zeek_add_plugin( Zeek FTP SOURCES - FTP.cc - Plugin.cc + FTP.cc + Plugin.cc BIFS - events.bif - functions.bif -) + events.bif + functions.bif) diff --git a/src/analyzer/protocol/gnutella/CMakeLists.txt b/src/analyzer/protocol/gnutella/CMakeLists.txt index 7177f2bb4b..58d28c5a37 100644 --- a/src/analyzer/protocol/gnutella/CMakeLists.txt +++ b/src/analyzer/protocol/gnutella/CMakeLists.txt @@ -2,8 +2,7 @@ zeek_add_plugin( Zeek Gnutella SOURCES - Gnutella.cc - Plugin.cc + Gnutella.cc + Plugin.cc BIFS - events.bif -) + events.bif) diff --git a/src/analyzer/protocol/gssapi/CMakeLists.txt b/src/analyzer/protocol/gssapi/CMakeLists.txt index c35ae4187b..454b45c5a2 100644 --- a/src/analyzer/protocol/gssapi/CMakeLists.txt +++ b/src/analyzer/protocol/gssapi/CMakeLists.txt @@ -2,13 +2,12 @@ zeek_add_plugin( Zeek GSSAPI SOURCES - GSSAPI.cc - Plugin.cc + GSSAPI.cc + Plugin.cc BIFS - events.bif + events.bif PAC - gssapi.pac - gssapi-protocol.pac - gssapi-analyzer.pac - ${PROJECT_SOURCE_DIR}/src/analyzer/protocol/asn1/asn1.pac -) + gssapi.pac + gssapi-protocol.pac + gssapi-analyzer.pac + ${PROJECT_SOURCE_DIR}/src/analyzer/protocol/asn1/asn1.pac) diff --git a/src/analyzer/protocol/http/CMakeLists.txt b/src/analyzer/protocol/http/CMakeLists.txt index eb1f66e9f0..a0088de732 100644 --- a/src/analyzer/protocol/http/CMakeLists.txt +++ b/src/analyzer/protocol/http/CMakeLists.txt @@ -2,9 +2,8 @@ zeek_add_plugin( Zeek HTTP SOURCES - HTTP.cc - Plugin.cc + HTTP.cc + Plugin.cc BIFS - events.bif - functions.bif -) + events.bif + functions.bif) diff --git a/src/analyzer/protocol/ident/CMakeLists.txt b/src/analyzer/protocol/ident/CMakeLists.txt index 549073420d..82c32491ee 100644 --- a/src/analyzer/protocol/ident/CMakeLists.txt +++ b/src/analyzer/protocol/ident/CMakeLists.txt @@ -2,8 +2,7 @@ zeek_add_plugin( Zeek Ident SOURCES - Ident.cc - Plugin.cc + Ident.cc + Plugin.cc BIFS - events.bif -) + events.bif) diff --git a/src/analyzer/protocol/imap/CMakeLists.txt b/src/analyzer/protocol/imap/CMakeLists.txt index 33f340b54f..257b1bf0bc 100644 --- a/src/analyzer/protocol/imap/CMakeLists.txt +++ b/src/analyzer/protocol/imap/CMakeLists.txt @@ -2,12 +2,11 @@ zeek_add_plugin( Zeek IMAP SOURCES - Plugin.cc - IMAP.cc + Plugin.cc + IMAP.cc BIFS - events.bif + events.bif PAC - imap.pac - imap-analyzer.pac - imap-protocol.pac -) + imap.pac + imap-analyzer.pac + imap-protocol.pac) diff --git a/src/analyzer/protocol/irc/CMakeLists.txt b/src/analyzer/protocol/irc/CMakeLists.txt index a99f0a5b72..0791a61c79 100644 --- a/src/analyzer/protocol/irc/CMakeLists.txt +++ b/src/analyzer/protocol/irc/CMakeLists.txt @@ -2,8 +2,7 @@ zeek_add_plugin( Zeek IRC SOURCES - IRC.cc - Plugin.cc + IRC.cc + Plugin.cc BIFS - events.bif -) + events.bif) diff --git a/src/analyzer/protocol/krb/CMakeLists.txt b/src/analyzer/protocol/krb/CMakeLists.txt index 192b9cf2bc..a9ac783095 100644 --- a/src/analyzer/protocol/krb/CMakeLists.txt +++ b/src/analyzer/protocol/krb/CMakeLists.txt @@ -2,28 +2,27 @@ zeek_add_plugin( Zeek KRB SOURCES - Plugin.cc - KRB.cc - KRB_TCP.cc + Plugin.cc + KRB.cc + KRB_TCP.cc BIFS - types.bif - events.bif + types.bif + events.bif PAC - krb.pac - krb-protocol.pac - krb-analyzer.pac - krb-asn1.pac - krb-defs.pac - krb-types.pac - krb-padata.pac - ${PROJECT_SOURCE_DIR}/src/analyzer/protocol/asn1/asn1.pac + krb.pac + krb-protocol.pac + krb-analyzer.pac + krb-asn1.pac + krb-defs.pac + krb-types.pac + krb-padata.pac + ${PROJECT_SOURCE_DIR}/src/analyzer/protocol/asn1/asn1.pac PAC - krb_TCP.pac - krb-protocol.pac - krb-analyzer.pac - krb-asn1.pac - krb-defs.pac - krb-types.pac - krb-padata.pac - ${PROJECT_SOURCE_DIR}/src/analyzer/protocol/asn1/asn1.pac -) + krb_TCP.pac + krb-protocol.pac + krb-analyzer.pac + krb-asn1.pac + krb-defs.pac + krb-types.pac + krb-padata.pac + ${PROJECT_SOURCE_DIR}/src/analyzer/protocol/asn1/asn1.pac) diff --git a/src/analyzer/protocol/login/CMakeLists.txt b/src/analyzer/protocol/login/CMakeLists.txt index 215d17dbd6..d2e78bd7ac 100644 --- a/src/analyzer/protocol/login/CMakeLists.txt +++ b/src/analyzer/protocol/login/CMakeLists.txt @@ -2,13 +2,12 @@ zeek_add_plugin( Zeek Login SOURCES - Login.cc - RSH.cc - Telnet.cc - Rlogin.cc - NVT.cc - Plugin.cc + Login.cc + RSH.cc + Telnet.cc + Rlogin.cc + NVT.cc + Plugin.cc BIFS - events.bif - functions.bif -) + events.bif + functions.bif) diff --git a/src/analyzer/protocol/mime/CMakeLists.txt b/src/analyzer/protocol/mime/CMakeLists.txt index 6936945852..774766d2d8 100644 --- a/src/analyzer/protocol/mime/CMakeLists.txt +++ b/src/analyzer/protocol/mime/CMakeLists.txt @@ -7,8 +7,7 @@ zeek_add_plugin( Zeek MIME SOURCES - MIME.cc - Plugin.cc + MIME.cc + Plugin.cc BIFS - events.bif -) + events.bif) diff --git a/src/analyzer/protocol/modbus/CMakeLists.txt b/src/analyzer/protocol/modbus/CMakeLists.txt index edb22e4727..1c2f078760 100644 --- a/src/analyzer/protocol/modbus/CMakeLists.txt +++ b/src/analyzer/protocol/modbus/CMakeLists.txt @@ -2,12 +2,11 @@ zeek_add_plugin( Zeek Modbus SOURCES - Modbus.cc - Plugin.cc + Modbus.cc + Plugin.cc BIFS - events.bif + events.bif PAC - modbus.pac - modbus-analyzer.pac - modbus-protocol.pac -) + modbus.pac + modbus-analyzer.pac + modbus-protocol.pac) diff --git a/src/analyzer/protocol/mqtt/CMakeLists.txt b/src/analyzer/protocol/mqtt/CMakeLists.txt index 471be968bb..7c55d984d2 100644 --- a/src/analyzer/protocol/mqtt/CMakeLists.txt +++ b/src/analyzer/protocol/mqtt/CMakeLists.txt @@ -2,26 +2,25 @@ zeek_add_plugin( Zeek MQTT SOURCES - MQTT.cc - Plugin.cc + MQTT.cc + Plugin.cc BIFS - types.bif - events.bif + types.bif + events.bif PAC - mqtt.pac - mqtt-protocol.pac - commands/connect.pac - commands/connack.pac - commands/publish.pac - commands/puback.pac - commands/pubrec.pac - commands/pubrel.pac - commands/pubcomp.pac - commands/subscribe.pac - commands/suback.pac - commands/unsuback.pac - commands/unsubscribe.pac - commands/disconnect.pac - commands/pingreq.pac - commands/pingresp.pac -) + mqtt.pac + mqtt-protocol.pac + commands/connect.pac + commands/connack.pac + commands/publish.pac + commands/puback.pac + commands/pubrec.pac + commands/pubrel.pac + commands/pubcomp.pac + commands/subscribe.pac + commands/suback.pac + commands/unsuback.pac + commands/unsubscribe.pac + commands/disconnect.pac + commands/pingreq.pac + commands/pingresp.pac) diff --git a/src/analyzer/protocol/mysql/CMakeLists.txt b/src/analyzer/protocol/mysql/CMakeLists.txt index deb369a18b..8dcecf637d 100644 --- a/src/analyzer/protocol/mysql/CMakeLists.txt +++ b/src/analyzer/protocol/mysql/CMakeLists.txt @@ -2,12 +2,11 @@ zeek_add_plugin( Zeek MySQL SOURCES - MySQL.cc - Plugin.cc + MySQL.cc + Plugin.cc BIFS - events.bif + events.bif PAC - mysql.pac - mysql-analyzer.pac - mysql-protocol.pac -) + mysql.pac + mysql-analyzer.pac + mysql-protocol.pac) diff --git a/src/analyzer/protocol/ncp/CMakeLists.txt b/src/analyzer/protocol/ncp/CMakeLists.txt index 55805782b4..dd217f9977 100644 --- a/src/analyzer/protocol/ncp/CMakeLists.txt +++ b/src/analyzer/protocol/ncp/CMakeLists.txt @@ -2,11 +2,10 @@ zeek_add_plugin( Zeek NCP SOURCES - NCP.cc - Plugin.cc + NCP.cc + Plugin.cc BIFS - events.bif - consts.bif + events.bif + consts.bif PAC - ncp.pac -) + ncp.pac) diff --git a/src/analyzer/protocol/netbios/CMakeLists.txt b/src/analyzer/protocol/netbios/CMakeLists.txt index e000eee6e5..ef2b863c4d 100644 --- a/src/analyzer/protocol/netbios/CMakeLists.txt +++ b/src/analyzer/protocol/netbios/CMakeLists.txt @@ -2,9 +2,8 @@ zeek_add_plugin( Zeek NetBIOS SOURCES - NetbiosSSN.cc - Plugin.cc + NetbiosSSN.cc + Plugin.cc BIFS - events.bif - functions.bif -) + events.bif + functions.bif) diff --git a/src/analyzer/protocol/ntlm/CMakeLists.txt b/src/analyzer/protocol/ntlm/CMakeLists.txt index 340551d9ba..f5cf25b1fd 100644 --- a/src/analyzer/protocol/ntlm/CMakeLists.txt +++ b/src/analyzer/protocol/ntlm/CMakeLists.txt @@ -2,13 +2,12 @@ zeek_add_plugin( Zeek NTLM SOURCES - NTLM.cc - Plugin.cc + NTLM.cc + Plugin.cc BIFS - types.bif - events.bif + types.bif + events.bif PAC - ntlm.pac - ntlm-protocol.pac - ntlm-analyzer.pac -) + ntlm.pac + ntlm-protocol.pac + ntlm-analyzer.pac) diff --git a/src/analyzer/protocol/ntp/CMakeLists.txt b/src/analyzer/protocol/ntp/CMakeLists.txt index 3f38c34b8b..1a062716bd 100644 --- a/src/analyzer/protocol/ntp/CMakeLists.txt +++ b/src/analyzer/protocol/ntp/CMakeLists.txt @@ -2,14 +2,13 @@ zeek_add_plugin( Zeek NTP SOURCES - NTP.cc - Plugin.cc + NTP.cc + Plugin.cc BIFS - types.bif - events.bif + types.bif + events.bif PAC - ntp.pac - ntp-analyzer.pac - ntp-mode7.pac - ntp-protocol.pac -) + ntp.pac + ntp-analyzer.pac + ntp-mode7.pac + ntp-protocol.pac) diff --git a/src/analyzer/protocol/pia/CMakeLists.txt b/src/analyzer/protocol/pia/CMakeLists.txt index ad7fdc8a55..e8ee99dd46 100644 --- a/src/analyzer/protocol/pia/CMakeLists.txt +++ b/src/analyzer/protocol/pia/CMakeLists.txt @@ -1,7 +1 @@ -zeek_add_plugin( - Zeek - PIA - SOURCES - PIA.cc - Plugin.cc -) +zeek_add_plugin(Zeek PIA SOURCES PIA.cc Plugin.cc) diff --git a/src/analyzer/protocol/pop3/CMakeLists.txt b/src/analyzer/protocol/pop3/CMakeLists.txt index 3de7ae5289..f5283b17e4 100644 --- a/src/analyzer/protocol/pop3/CMakeLists.txt +++ b/src/analyzer/protocol/pop3/CMakeLists.txt @@ -2,8 +2,7 @@ zeek_add_plugin( Zeek POP3 SOURCES - POP3.cc - Plugin.cc + POP3.cc + Plugin.cc BIFS - events.bif -) + events.bif) diff --git a/src/analyzer/protocol/radius/CMakeLists.txt b/src/analyzer/protocol/radius/CMakeLists.txt index 62c541fa58..3239bc71c7 100644 --- a/src/analyzer/protocol/radius/CMakeLists.txt +++ b/src/analyzer/protocol/radius/CMakeLists.txt @@ -2,12 +2,11 @@ zeek_add_plugin( Zeek RADIUS SOURCES - RADIUS.cc - Plugin.cc + RADIUS.cc + Plugin.cc BIFS - events.bif + events.bif PAC - radius.pac - radius-analyzer.pac - radius-protocol.pac -) + radius.pac + radius-analyzer.pac + radius-protocol.pac) diff --git a/src/analyzer/protocol/rdp/CMakeLists.txt b/src/analyzer/protocol/rdp/CMakeLists.txt index 836dc45ca8..2cc96a0768 100644 --- a/src/analyzer/protocol/rdp/CMakeLists.txt +++ b/src/analyzer/protocol/rdp/CMakeLists.txt @@ -2,19 +2,18 @@ zeek_add_plugin( Zeek RDP SOURCES - RDPEUDP.cc - RDP.cc - Plugin.cc + RDPEUDP.cc + RDP.cc + Plugin.cc BIFS - events.bif - types.bif + events.bif + types.bif PAC - rdp.pac - rdp-analyzer.pac - rdp-protocol.pac - ${PROJECT_SOURCE_DIR}/src/analyzer/protocol/asn1/asn1.pac + rdp.pac + rdp-analyzer.pac + rdp-protocol.pac + ${PROJECT_SOURCE_DIR}/src/analyzer/protocol/asn1/asn1.pac PAC - rdpeudp.pac - rdpeudp-analyzer.pac - rdpeudp-protocol.pac -) + rdpeudp.pac + rdpeudp-analyzer.pac + rdpeudp-protocol.pac) diff --git a/src/analyzer/protocol/rfb/CMakeLists.txt b/src/analyzer/protocol/rfb/CMakeLists.txt index 0d902b55d7..ee23af1e88 100644 --- a/src/analyzer/protocol/rfb/CMakeLists.txt +++ b/src/analyzer/protocol/rfb/CMakeLists.txt @@ -2,12 +2,11 @@ zeek_add_plugin( Zeek RFB SOURCES - RFB.cc - Plugin.cc + RFB.cc + Plugin.cc BIFS - events.bif + events.bif PAC - rfb.pac - rfb-analyzer.pac - rfb-protocol.pac -) + rfb.pac + rfb-analyzer.pac + rfb-protocol.pac) diff --git a/src/analyzer/protocol/rpc/CMakeLists.txt b/src/analyzer/protocol/rpc/CMakeLists.txt index e871ec1956..fcb3547b04 100644 --- a/src/analyzer/protocol/rpc/CMakeLists.txt +++ b/src/analyzer/protocol/rpc/CMakeLists.txt @@ -2,12 +2,11 @@ zeek_add_plugin( Zeek RPC SOURCES - RPC.cc - NFS.cc - MOUNT.cc - Portmap.cc - XDR.cc - Plugin.cc + RPC.cc + NFS.cc + MOUNT.cc + Portmap.cc + XDR.cc + Plugin.cc BIFS - events.bif -) + events.bif) diff --git a/src/analyzer/protocol/sip/CMakeLists.txt b/src/analyzer/protocol/sip/CMakeLists.txt index 1fb64bf0af..1d3d9a7d8d 100644 --- a/src/analyzer/protocol/sip/CMakeLists.txt +++ b/src/analyzer/protocol/sip/CMakeLists.txt @@ -2,17 +2,16 @@ zeek_add_plugin( Zeek SIP SOURCES - Plugin.cc - SIP.cc - SIP_TCP.cc + Plugin.cc + SIP.cc + SIP_TCP.cc BIFS - events.bif + events.bif PAC - sip.pac - sip-analyzer.pac - sip-protocol.pac + sip.pac + sip-analyzer.pac + sip-protocol.pac PAC - sip_TCP.pac - sip-protocol.pac - sip-analyzer.pac -) + sip_TCP.pac + sip-protocol.pac + sip-analyzer.pac) diff --git a/src/analyzer/protocol/smb/CMakeLists.txt b/src/analyzer/protocol/smb/CMakeLists.txt index 7466dbd263..4bd7cf1eee 100644 --- a/src/analyzer/protocol/smb/CMakeLists.txt +++ b/src/analyzer/protocol/smb/CMakeLists.txt @@ -2,88 +2,87 @@ zeek_add_plugin( Zeek SMB SOURCES - SMB.cc - Plugin.cc + SMB.cc + Plugin.cc BIFS - # SMB 1. - smb1_com_check_directory.bif - smb1_com_close.bif - smb1_com_create_directory.bif - smb1_com_echo.bif - smb1_com_logoff_andx.bif - smb1_com_negotiate.bif - smb1_com_nt_create_andx.bif - smb1_com_nt_cancel.bif - smb1_com_query_information.bif - smb1_com_read_andx.bif - smb1_com_session_setup_andx.bif - smb1_com_transaction.bif - smb1_com_transaction_secondary.bif - smb1_com_transaction2.bif - smb1_com_transaction2_secondary.bif - smb1_com_tree_connect_andx.bif - smb1_com_tree_disconnect.bif - smb1_com_write_andx.bif - smb1_events.bif - # SMB 2. - smb2_com_close.bif - smb2_com_create.bif - smb2_com_negotiate.bif - smb2_com_read.bif - smb2_com_session_setup.bif - smb2_com_set_info.bif - smb2_com_tree_connect.bif - smb2_com_tree_disconnect.bif - smb2_com_write.bif - smb2_com_transform_header.bif - smb2_events.bif - # Common boilerplate. - events.bif - consts.bif - types.bif + # SMB 1. + smb1_com_check_directory.bif + smb1_com_close.bif + smb1_com_create_directory.bif + smb1_com_echo.bif + smb1_com_logoff_andx.bif + smb1_com_negotiate.bif + smb1_com_nt_create_andx.bif + smb1_com_nt_cancel.bif + smb1_com_query_information.bif + smb1_com_read_andx.bif + smb1_com_session_setup_andx.bif + smb1_com_transaction.bif + smb1_com_transaction_secondary.bif + smb1_com_transaction2.bif + smb1_com_transaction2_secondary.bif + smb1_com_tree_connect_andx.bif + smb1_com_tree_disconnect.bif + smb1_com_write_andx.bif + smb1_events.bif + # SMB 2. + smb2_com_close.bif + smb2_com_create.bif + smb2_com_negotiate.bif + smb2_com_read.bif + smb2_com_session_setup.bif + smb2_com_set_info.bif + smb2_com_tree_connect.bif + smb2_com_tree_disconnect.bif + smb2_com_write.bif + smb2_com_transform_header.bif + smb2_events.bif + # Common boilerplate. + events.bif + consts.bif + types.bif PAC - # Common boilerplate. - smb.pac - smb-common.pac - smb-strings.pac - smb-time.pac - smb-pipe.pac - smb-gssapi.pac - smb-mailslot.pac - # SMB 1. - smb1-protocol.pac - smb1-com-check-directory.pac - smb1-com-close.pac - smb1-com-create-directory.pac - smb1-com-echo.pac - smb1-com-locking-andx.pac - smb1-com-logoff-andx.pac - smb1-com-negotiate.pac - smb1-com-nt-cancel.pac - smb1-com-nt-create-andx.pac - smb1-com-nt-transact.pac - smb1-com-query-information.pac - smb1-com-read-andx.pac - smb1-com-session-setup-andx.pac - smb1-com-transaction-secondary.pac - smb1-com-transaction.pac - smb1-com-transaction2.pac - smb1-com-transaction2-secondary.pac - smb1-com-tree-connect-andx.pac - smb1-com-tree-disconnect.pac - smb1-com-write-andx.pac - # SMB 2. - smb2-protocol.pac - smb2-com-close.pac - smb2-com-create.pac - smb2-com-ioctl.pac - smb2-com-lock.pac - smb2-com-negotiate.pac - smb2-com-read.pac - smb2-com-session-setup.pac - smb2-com-set-info.pac - smb2-com-tree-connect.pac - smb2-com-tree-disconnect.pac - smb2-com-write.pac - smb2-com-transform-header.pac -) + # Common boilerplate. + smb.pac + smb-common.pac + smb-strings.pac + smb-time.pac + smb-pipe.pac + smb-gssapi.pac + smb-mailslot.pac + # SMB 1. + smb1-protocol.pac + smb1-com-check-directory.pac + smb1-com-close.pac + smb1-com-create-directory.pac + smb1-com-echo.pac + smb1-com-locking-andx.pac + smb1-com-logoff-andx.pac + smb1-com-negotiate.pac + smb1-com-nt-cancel.pac + smb1-com-nt-create-andx.pac + smb1-com-nt-transact.pac + smb1-com-query-information.pac + smb1-com-read-andx.pac + smb1-com-session-setup-andx.pac + smb1-com-transaction-secondary.pac + smb1-com-transaction.pac + smb1-com-transaction2.pac + smb1-com-transaction2-secondary.pac + smb1-com-tree-connect-andx.pac + smb1-com-tree-disconnect.pac + smb1-com-write-andx.pac + # SMB 2. + smb2-protocol.pac + smb2-com-close.pac + smb2-com-create.pac + smb2-com-ioctl.pac + smb2-com-lock.pac + smb2-com-negotiate.pac + smb2-com-read.pac + smb2-com-session-setup.pac + smb2-com-set-info.pac + smb2-com-tree-connect.pac + smb2-com-tree-disconnect.pac + smb2-com-write.pac + smb2-com-transform-header.pac) diff --git a/src/analyzer/protocol/smtp/CMakeLists.txt b/src/analyzer/protocol/smtp/CMakeLists.txt index e1618af641..b302045985 100644 --- a/src/analyzer/protocol/smtp/CMakeLists.txt +++ b/src/analyzer/protocol/smtp/CMakeLists.txt @@ -2,9 +2,8 @@ zeek_add_plugin( Zeek SMTP SOURCES - SMTP.cc - Plugin.cc + SMTP.cc + Plugin.cc BIFS - events.bif - functions.bif -) + events.bif + functions.bif) diff --git a/src/analyzer/protocol/snmp/CMakeLists.txt b/src/analyzer/protocol/snmp/CMakeLists.txt index d93762aa75..48c829d91b 100644 --- a/src/analyzer/protocol/snmp/CMakeLists.txt +++ b/src/analyzer/protocol/snmp/CMakeLists.txt @@ -2,14 +2,13 @@ zeek_add_plugin( Zeek SNMP SOURCES - SNMP.cc - Plugin.cc + SNMP.cc + Plugin.cc BIFS - types.bif - events.bif + types.bif + events.bif PAC - snmp.pac - snmp-protocol.pac - snmp-analyzer.pac - ${PROJECT_SOURCE_DIR}/src/analyzer/protocol/asn1/asn1.pac -) + snmp.pac + snmp-protocol.pac + snmp-analyzer.pac + ${PROJECT_SOURCE_DIR}/src/analyzer/protocol/asn1/asn1.pac) diff --git a/src/analyzer/protocol/socks/CMakeLists.txt b/src/analyzer/protocol/socks/CMakeLists.txt index fa0e6b083d..7d11ee70d5 100644 --- a/src/analyzer/protocol/socks/CMakeLists.txt +++ b/src/analyzer/protocol/socks/CMakeLists.txt @@ -2,12 +2,11 @@ zeek_add_plugin( Zeek SOCKS SOURCES - SOCKS.cc - Plugin.cc + SOCKS.cc + Plugin.cc BIFS - events.bif + events.bif PAC - socks.pac - socks-protocol.pac - socks-analyzer.pac -) + socks.pac + socks-protocol.pac + socks-analyzer.pac) diff --git a/src/analyzer/protocol/ssh/CMakeLists.txt b/src/analyzer/protocol/ssh/CMakeLists.txt index 6205089530..f2364bffef 100644 --- a/src/analyzer/protocol/ssh/CMakeLists.txt +++ b/src/analyzer/protocol/ssh/CMakeLists.txt @@ -2,14 +2,13 @@ zeek_add_plugin( Zeek SSH SOURCES - SSH.cc - Plugin.cc + SSH.cc + Plugin.cc BIFS - types.bif - events.bif + types.bif + events.bif PAC - ssh.pac - ssh-analyzer.pac - ssh-protocol.pac - consts.pac -) + ssh.pac + ssh-analyzer.pac + ssh-protocol.pac + consts.pac) diff --git a/src/analyzer/protocol/ssl/CMakeLists.txt b/src/analyzer/protocol/ssl/CMakeLists.txt index 3cc3fc5649..5c686b16cf 100644 --- a/src/analyzer/protocol/ssl/CMakeLists.txt +++ b/src/analyzer/protocol/ssl/CMakeLists.txt @@ -2,34 +2,33 @@ zeek_add_plugin( Zeek SSL SOURCES - SSL.cc - DTLS.cc - Plugin.cc + SSL.cc + DTLS.cc + Plugin.cc BIFS - types.bif - events.bif - functions.bif - consts.bif + types.bif + events.bif + functions.bif + consts.bif PAC - tls-handshake.pac - tls-handshake-protocol.pac - tls-handshake-analyzer.pac - ssl-defs.pac - proc-certificate.pac - tls-handshake-signed_certificate_timestamp.pac + tls-handshake.pac + tls-handshake-protocol.pac + tls-handshake-analyzer.pac + ssl-defs.pac + proc-certificate.pac + tls-handshake-signed_certificate_timestamp.pac PAC - ssl.pac - ssl-dtls-analyzer.pac - ssl-analyzer.pac - ssl-dtls-protocol.pac - ssl-protocol.pac - ssl-defs.pac - proc-certificate.pac + ssl.pac + ssl-dtls-analyzer.pac + ssl-analyzer.pac + ssl-dtls-protocol.pac + ssl-protocol.pac + ssl-defs.pac + proc-certificate.pac PAC - dtls.pac - ssl-dtls-analyzer.pac - dtls-analyzer.pac - ssl-dtls-protocol.pac - dtls-protocol.pac - ssl-defs.pac -) + dtls.pac + ssl-dtls-analyzer.pac + dtls-analyzer.pac + ssl-dtls-protocol.pac + dtls-protocol.pac + ssl-defs.pac) diff --git a/src/analyzer/protocol/syslog/CMakeLists.txt b/src/analyzer/protocol/syslog/CMakeLists.txt index c80aefeb32..57c78fdf92 100644 --- a/src/analyzer/protocol/syslog/CMakeLists.txt +++ b/src/analyzer/protocol/syslog/CMakeLists.txt @@ -1,9 +1,8 @@ spicy_add_analyzer( - NAME + NAME Syslog - SOURCES + SOURCES syslog.spicy syslog.evt - LEGACY - legacy -) + LEGACY + legacy) diff --git a/src/analyzer/protocol/syslog/legacy/CMakeLists.txt b/src/analyzer/protocol/syslog/legacy/CMakeLists.txt index 472344a519..ef2f7330d5 100644 --- a/src/analyzer/protocol/syslog/legacy/CMakeLists.txt +++ b/src/analyzer/protocol/syslog/legacy/CMakeLists.txt @@ -2,12 +2,11 @@ zeek_add_plugin( Zeek Syslog SOURCES - Syslog.cc - Plugin.cc + Syslog.cc + Plugin.cc BIFS - events.bif + events.bif PAC - syslog.pac - syslog-analyzer.pac - syslog-protocol.pac -) + syslog.pac + syslog-analyzer.pac + syslog-protocol.pac) diff --git a/src/analyzer/protocol/tcp/CMakeLists.txt b/src/analyzer/protocol/tcp/CMakeLists.txt index 613fdc2249..42e41c9dac 100644 --- a/src/analyzer/protocol/tcp/CMakeLists.txt +++ b/src/analyzer/protocol/tcp/CMakeLists.txt @@ -2,13 +2,12 @@ zeek_add_plugin( Zeek TCP SOURCES - TCP.cc - TCP_Endpoint.cc - TCP_Reassembler.cc - ContentLine.cc - Plugin.cc + TCP.cc + TCP_Endpoint.cc + TCP_Reassembler.cc + ContentLine.cc + Plugin.cc BIFS - events.bif - types.bif - functions.bif -) + events.bif + types.bif + functions.bif) diff --git a/src/analyzer/protocol/xmpp/CMakeLists.txt b/src/analyzer/protocol/xmpp/CMakeLists.txt index aa3b8336a6..3ea127d691 100644 --- a/src/analyzer/protocol/xmpp/CMakeLists.txt +++ b/src/analyzer/protocol/xmpp/CMakeLists.txt @@ -2,12 +2,11 @@ zeek_add_plugin( Zeek XMPP SOURCES - Plugin.cc - XMPP.cc + Plugin.cc + XMPP.cc BIFS - events.bif + events.bif PAC - xmpp.pac - xmpp-analyzer.pac - xmpp-protocol.pac -) + xmpp.pac + xmpp-analyzer.pac + xmpp-protocol.pac) diff --git a/src/analyzer/protocol/zip/CMakeLists.txt b/src/analyzer/protocol/zip/CMakeLists.txt index d51057c15d..e7c11ccdbb 100644 --- a/src/analyzer/protocol/zip/CMakeLists.txt +++ b/src/analyzer/protocol/zip/CMakeLists.txt @@ -1,7 +1 @@ -zeek_add_plugin( - Zeek - ZIP - SOURCES - ZIP.cc - Plugin.cc -) +zeek_add_plugin(Zeek ZIP SOURCES ZIP.cc Plugin.cc) diff --git a/src/broker/CMakeLists.txt b/src/broker/CMakeLists.txt index e2e54b288d..472f67e11d 100644 --- a/src/broker/CMakeLists.txt +++ b/src/broker/CMakeLists.txt @@ -1,13 +1,14 @@ zeek_add_subdir_library( comm - INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} + INCLUDE_DIRS + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} SOURCES - Data.cc - Manager.cc - Store.cc + Data.cc + Manager.cc + Store.cc BIFS - comm.bif - data.bif - messaging.bif - store.bif -) + comm.bif + data.bif + messaging.bif + store.bif) diff --git a/src/file_analysis/CMakeLists.txt b/src/file_analysis/CMakeLists.txt index 80d842e8fc..7920c40f36 100644 --- a/src/file_analysis/CMakeLists.txt +++ b/src/file_analysis/CMakeLists.txt @@ -1,16 +1,17 @@ zeek_add_subdir_library( file_analysis - INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} + INCLUDE_DIRS + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} SOURCES - Manager.cc - File.cc - FileTimer.cc - FileReassembler.cc - Analyzer.cc - AnalyzerSet.cc - Component.cc + Manager.cc + File.cc + FileTimer.cc + FileReassembler.cc + Analyzer.cc + AnalyzerSet.cc + Component.cc BIFS - file_analysis.bif -) + file_analysis.bif) add_subdirectory(analyzer) diff --git a/src/file_analysis/analyzer/data_event/CMakeLists.txt b/src/file_analysis/analyzer/data_event/CMakeLists.txt index e8eda489f0..eb8042dd77 100644 --- a/src/file_analysis/analyzer/data_event/CMakeLists.txt +++ b/src/file_analysis/analyzer/data_event/CMakeLists.txt @@ -2,8 +2,7 @@ zeek_add_plugin( Zeek FileDataEvent SOURCES - DataEvent.cc - Plugin.cc + DataEvent.cc + Plugin.cc INCLUDE_DIRS - "${CMAKE_CURRENT_SOURCE_DIR}" -) + "${CMAKE_CURRENT_SOURCE_DIR}") diff --git a/src/file_analysis/analyzer/entropy/CMakeLists.txt b/src/file_analysis/analyzer/entropy/CMakeLists.txt index 6608822199..944cf64a3c 100644 --- a/src/file_analysis/analyzer/entropy/CMakeLists.txt +++ b/src/file_analysis/analyzer/entropy/CMakeLists.txt @@ -2,8 +2,7 @@ zeek_add_plugin( Zeek FileEntropy SOURCES - Entropy.cc - Plugin.cc + Entropy.cc + Plugin.cc BIFS - events.bif -) + events.bif) diff --git a/src/file_analysis/analyzer/extract/CMakeLists.txt b/src/file_analysis/analyzer/extract/CMakeLists.txt index 38ce0fd4db..0c08872172 100644 --- a/src/file_analysis/analyzer/extract/CMakeLists.txt +++ b/src/file_analysis/analyzer/extract/CMakeLists.txt @@ -2,9 +2,8 @@ zeek_add_plugin( Zeek FileExtract SOURCES - Extract.cc - Plugin.cc + Extract.cc + Plugin.cc BIFS - events.bif - functions.bif -) + events.bif + functions.bif) diff --git a/src/file_analysis/analyzer/hash/CMakeLists.txt b/src/file_analysis/analyzer/hash/CMakeLists.txt index fc1fcf50de..adfd96007f 100644 --- a/src/file_analysis/analyzer/hash/CMakeLists.txt +++ b/src/file_analysis/analyzer/hash/CMakeLists.txt @@ -2,8 +2,7 @@ zeek_add_plugin( Zeek FileHash SOURCES - Hash.cc - Plugin.cc + Hash.cc + Plugin.cc BIFS - events.bif -) + events.bif) diff --git a/src/file_analysis/analyzer/pe/CMakeLists.txt b/src/file_analysis/analyzer/pe/CMakeLists.txt index dd8000f1eb..ff98b004db 100644 --- a/src/file_analysis/analyzer/pe/CMakeLists.txt +++ b/src/file_analysis/analyzer/pe/CMakeLists.txt @@ -2,15 +2,14 @@ zeek_add_plugin( Zeek PE SOURCES - PE.cc - Plugin.cc + PE.cc + Plugin.cc BIFS - events.bif + events.bif PAC - pe.pac - pe-analyzer.pac - pe-file-headers.pac - pe-file-idata.pac - pe-file.pac - pe-file-types.pac -) + pe.pac + pe-analyzer.pac + pe-file-headers.pac + pe-file-idata.pac + pe-file.pac + pe-file-types.pac) diff --git a/src/file_analysis/analyzer/x509/CMakeLists.txt b/src/file_analysis/analyzer/x509/CMakeLists.txt index dbd93f0d3a..7f9541df0d 100644 --- a/src/file_analysis/analyzer/x509/CMakeLists.txt +++ b/src/file_analysis/analyzer/x509/CMakeLists.txt @@ -2,16 +2,15 @@ zeek_add_plugin( Zeek X509 SOURCES - X509Common.cc - X509.cc - OCSP.cc - Plugin.cc + X509Common.cc + X509.cc + OCSP.cc + Plugin.cc BIFS - events.bif - types.bif - functions.bif - ocsp_events.bif + events.bif + types.bif + functions.bif + ocsp_events.bif PAC - x509-extension.pac - x509-signed_certificate_timestamp.pac -) + x509-extension.pac + x509-signed_certificate_timestamp.pac) diff --git a/src/fuzzers/CMakeLists.txt b/src/fuzzers/CMakeLists.txt index a7bef79ecb..5bf6e7b5eb 100644 --- a/src/fuzzers/CMakeLists.txt +++ b/src/fuzzers/CMakeLists.txt @@ -1,18 +1,18 @@ -######################################################################## -## Fuzzing targets +# ############################################################################## +# Fuzzing targets -if ( NOT ZEEK_ENABLE_FUZZERS ) +if (NOT ZEEK_ENABLE_FUZZERS) return() endif () -if ( NOT DEFINED ZEEK_FUZZING_ENGINE AND DEFINED ENV{LIB_FUZZING_ENGINE} ) - if ( "$ENV{LIB_FUZZING_ENGINE}" STREQUAL "" ) +if (NOT DEFINED ZEEK_FUZZING_ENGINE AND DEFINED ENV{LIB_FUZZING_ENGINE}) + if ("$ENV{LIB_FUZZING_ENGINE}" STREQUAL "") # Empty LIB_FUZZING_ENGINE, assume libFuzzer set(ZEEK_FUZZING_ENGINE "-fsanitize=fuzzer" CACHE INTERNAL "" FORCE) else () - STRING(SUBSTRING "$ENV{LIB_FUZZING_ENGINE}" 0 1 _first_char) + string(SUBSTRING "$ENV{LIB_FUZZING_ENGINE}" 0 1 _first_char) - if ( "${_first_char}" STREQUAL "-" OR EXISTS "$ENV{LIB_FUZZING_ENGINE}" ) + if ("${_first_char}" STREQUAL "-" OR EXISTS "$ENV{LIB_FUZZING_ENGINE}") # Looks like a linker flag or valid file, use it set(ZEEK_FUZZING_ENGINE "$ENV{LIB_FUZZING_ENGINE}" CACHE INTERNAL "" FORCE) else () @@ -23,37 +23,36 @@ if ( NOT DEFINED ZEEK_FUZZING_ENGINE AND DEFINED ENV{LIB_FUZZING_ENGINE} ) endif () # The bind library is handled a bit hack-ishly since it defaults to linking it -# as static library by default on Linux, but at least on one common distro, -# that static library wasn't compiled with -fPIC and so not usable in the -# shared library we're trying to build. So instead, the fuzzer executable, not -# the shared lib, links it. +# as static library by default on Linux, but at least on one common distro, that +# static library wasn't compiled with -fPIC and so not usable in the shared +# library we're trying to build. So instead, the fuzzer executable, not the +# shared lib, links it. string(REGEX MATCH ".*\\.a$" _have_static_bind_lib "${BIND_LIBRARY}") -macro(SETUP_FUZZ_TARGET _fuzz_target _fuzz_source) +macro (SETUP_FUZZ_TARGET _fuzz_target _fuzz_source) add_executable(${_fuzz_target} ${_fuzz_source} ${ARGN}) target_link_libraries(${_fuzz_target} zeek_fuzzer_shared) - if ( _have_static_bind_lib ) + if (_have_static_bind_lib) target_link_libraries(${_fuzz_target} ${BIND_LIBRARY}) endif () target_link_libraries(${_fuzz_target} ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS}) - if ( DEFINED ZEEK_FUZZING_ENGINE ) + if (DEFINED ZEEK_FUZZING_ENGINE) target_link_libraries(${_fuzz_target} ${ZEEK_FUZZING_ENGINE}) else () - target_link_libraries(${_fuzz_target} - $) + target_link_libraries(${_fuzz_target} $) endif () -endmacro() +endmacro () -macro(ADD_FUZZ_TARGET _name) +macro (ADD_FUZZ_TARGET _name) set(_fuzz_target zeek-${_name}-fuzzer) set(_fuzz_source ${_name}-fuzzer.cc) setup_fuzz_target(${_fuzz_target} ${_fuzz_source}) endmacro () -macro(ADD_GENERIC_ANALYZER_FUZZ_TARGET _name) +macro (ADD_GENERIC_ANALYZER_FUZZ_TARGET _name) set(_fuzz_target zeek-${_name}-fuzzer) set(_fuzz_source generic-analyzer-fuzzer.cc) setup_fuzz_target(${_fuzz_target} ${_fuzz_source}) @@ -68,9 +67,9 @@ target_sources(zeek_fuzzer_shared PRIVATE FuzzBuffer.cc) set(zeek_fuzzer_shared_deps) -foreach(_dep ${zeekdeps} ) - if ( "${_dep}" STREQUAL "${BIND_LIBRARY}" ) - if ( NOT _have_static_bind_lib ) +foreach (_dep ${zeekdeps}) + if ("${_dep}" STREQUAL "${BIND_LIBRARY}") + if (NOT _have_static_bind_lib) set(zeek_fuzzer_shared_deps ${zeek_fuzzer_shared_deps} ${_dep}) endif () else () @@ -78,9 +77,8 @@ foreach(_dep ${zeekdeps} ) endif () endforeach () -target_link_libraries(zeek_fuzzer_shared PUBLIC - ${zeek_fuzzer_shared_deps} - ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS}) +target_link_libraries(zeek_fuzzer_shared PUBLIC ${zeek_fuzzer_shared_deps} + ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS}) add_fuzz_target(packet) add_fuzz_target(dns) @@ -104,26 +102,27 @@ add_generic_analyzer_fuzz_target(radius) add_generic_analyzer_fuzz_target(rdp) add_generic_analyzer_fuzz_target(rdpeudp) add_generic_analyzer_fuzz_target(rfb) -add_generic_analyzer_fuzz_target(mount) #rpc -add_generic_analyzer_fuzz_target(nfs) #rpc -add_generic_analyzer_fuzz_target(portmapper) #rpc +add_generic_analyzer_fuzz_target(mount) # rpc +add_generic_analyzer_fuzz_target(nfs) # rpc +add_generic_analyzer_fuzz_target(portmapper) # rpc add_generic_analyzer_fuzz_target(sip) add_generic_analyzer_fuzz_target(smb) add_generic_analyzer_fuzz_target(snmp) add_generic_analyzer_fuzz_target(ssh) add_generic_analyzer_fuzz_target(syslog) -#add_generic_analyzer_fuzz_target(finger) # no pcap files -#add_generic_analyzer_fuzz_target(gssapi) # only samples are embedded in smb -#add_generic_analyzer_fuzz_target(ident) # no pcap files -#add_generic_analyzer_fuzz_target(krb) # should these just be handled by smb? -#add_generic_analyzer_fuzz_target(krb_tcp) # should these just be handled by smb? -#add_generic_analyzer_fuzz_target(rsh) # login - no pcap files -#add_generic_analyzer_fuzz_target(rlogin) # login - no pcap files -#add_generic_analyzer_fuzz_target(telnet) # login - no pcap files -#add_generic_analyzer_fuzz_target(netbios) # no pcap files -#add_generic_analyzer_fuzz_target(ntlm) # only samples are embedded in dce-rpc or smb -#add_generic_analyzer_fuzz_target(xdr) # rpc - no pcap files -#add_generic_analyzer_fuzz_target(sip_tcp) # unnecessary? -#add_generic_analyzer_fuzz_target(socks) # can this one be tested by adding SOCKS pkts to the HTTP corpus? -#add_generic_analyzer_fuzz_target(xmpp) # no pcap files +# add_generic_analyzer_fuzz_target(finger) # no pcap files +# add_generic_analyzer_fuzz_target(gssapi) # only samples are embedded in smb +# add_generic_analyzer_fuzz_target(ident) # no pcap files +# add_generic_analyzer_fuzz_target(krb) # should these just be handled by +# smb? add_generic_analyzer_fuzz_target(krb_tcp) # should these just be handled +# by smb? add_generic_analyzer_fuzz_target(rsh) # login - no pcap files +# add_generic_analyzer_fuzz_target(rlogin) # login - no pcap files +# add_generic_analyzer_fuzz_target(telnet) # login - no pcap files +# add_generic_analyzer_fuzz_target(netbios) # no pcap files +# add_generic_analyzer_fuzz_target(ntlm) # only samples are embedded in +# dce-rpc or smb add_generic_analyzer_fuzz_target(xdr) # rpc - no pcap files +# add_generic_analyzer_fuzz_target(sip_tcp) # unnecessary? +# add_generic_analyzer_fuzz_target(socks) # can this one be tested by adding +# SOCKS pkts to the HTTP corpus? add_generic_analyzer_fuzz_target(xmpp) # no +# pcap files diff --git a/src/input/CMakeLists.txt b/src/input/CMakeLists.txt index 45c2c2cf58..72fb6acd62 100644 --- a/src/input/CMakeLists.txt +++ b/src/input/CMakeLists.txt @@ -1,12 +1,11 @@ zeek_add_subdir_library( input SOURCES - Component.cc - Manager.cc - ReaderBackend.cc - ReaderFrontend.cc + Component.cc + Manager.cc + ReaderBackend.cc + ReaderFrontend.cc BIFS - input.bif -) + input.bif) add_subdirectory(readers) diff --git a/src/input/readers/CMakeLists.txt b/src/input/readers/CMakeLists.txt index 032a286052..673424e1c2 100644 --- a/src/input/readers/CMakeLists.txt +++ b/src/input/readers/CMakeLists.txt @@ -1,4 +1,3 @@ - add_subdirectory(ascii) add_subdirectory(benchmark) add_subdirectory(binary) @@ -6,4 +5,4 @@ add_subdirectory(config) add_subdirectory(raw) if (USE_SQLITE) add_subdirectory(sqlite) -endif() +endif () diff --git a/src/input/readers/ascii/CMakeLists.txt b/src/input/readers/ascii/CMakeLists.txt index 2a4d81ba2f..fc2aa5645e 100644 --- a/src/input/readers/ascii/CMakeLists.txt +++ b/src/input/readers/ascii/CMakeLists.txt @@ -2,8 +2,7 @@ zeek_add_plugin( Zeek AsciiReader SOURCES - Ascii.cc - Plugin.cc + Ascii.cc + Plugin.cc BIFS - ascii.bif -) + ascii.bif) diff --git a/src/input/readers/benchmark/CMakeLists.txt b/src/input/readers/benchmark/CMakeLists.txt index f40091e955..25a4bdce82 100644 --- a/src/input/readers/benchmark/CMakeLists.txt +++ b/src/input/readers/benchmark/CMakeLists.txt @@ -2,8 +2,7 @@ zeek_add_plugin( Zeek BenchmarkReader SOURCES - Benchmark.cc - Plugin.cc + Benchmark.cc + Plugin.cc BIFS - benchmark.bif -) + benchmark.bif) diff --git a/src/input/readers/binary/CMakeLists.txt b/src/input/readers/binary/CMakeLists.txt index 83ddb18bc6..0025bec76f 100644 --- a/src/input/readers/binary/CMakeLists.txt +++ b/src/input/readers/binary/CMakeLists.txt @@ -2,8 +2,7 @@ zeek_add_plugin( Zeek BinaryReader SOURCES - Binary.cc - Plugin.cc + Binary.cc + Plugin.cc BIFS - binary.bif -) + binary.bif) diff --git a/src/input/readers/config/CMakeLists.txt b/src/input/readers/config/CMakeLists.txt index dfe3005a23..aaafc14e6e 100644 --- a/src/input/readers/config/CMakeLists.txt +++ b/src/input/readers/config/CMakeLists.txt @@ -2,8 +2,7 @@ zeek_add_plugin( Zeek ConfigReader SOURCES - Config.cc - Plugin.cc + Config.cc + Plugin.cc BIFS - config.bif -) + config.bif) diff --git a/src/input/readers/raw/CMakeLists.txt b/src/input/readers/raw/CMakeLists.txt index 6efeb00637..9d70b4c4c8 100644 --- a/src/input/readers/raw/CMakeLists.txt +++ b/src/input/readers/raw/CMakeLists.txt @@ -2,8 +2,7 @@ zeek_add_plugin( Zeek RawReader SOURCES - Raw.cc - Plugin.cc + Raw.cc + Plugin.cc BIFS - raw.bif -) + raw.bif) diff --git a/src/input/readers/sqlite/CMakeLists.txt b/src/input/readers/sqlite/CMakeLists.txt index 7d38b66baa..bb8bd4159c 100644 --- a/src/input/readers/sqlite/CMakeLists.txt +++ b/src/input/readers/sqlite/CMakeLists.txt @@ -2,8 +2,7 @@ zeek_add_plugin( Zeek SQLiteReader SOURCES - SQLite.cc - Plugin.cc + SQLite.cc + Plugin.cc BIFS - sqlite.bif -) + sqlite.bif) diff --git a/src/iosource/CMakeLists.txt b/src/iosource/CMakeLists.txt index 73a433ece4..63881464a5 100644 --- a/src/iosource/CMakeLists.txt +++ b/src/iosource/CMakeLists.txt @@ -1,12 +1,11 @@ zeek_add_subdir_library( iosource SOURCES - BPF_Program.cc - Component.cc - Manager.cc - Packet.cc - PktDumper.cc - PktSrc.cc -) + BPF_Program.cc + Component.cc + Manager.cc + Packet.cc + PktDumper.cc + PktSrc.cc) add_subdirectory(pcap) diff --git a/src/iosource/pcap/CMakeLists.txt b/src/iosource/pcap/CMakeLists.txt index f3dd6adc2a..1102815afd 100644 --- a/src/iosource/pcap/CMakeLists.txt +++ b/src/iosource/pcap/CMakeLists.txt @@ -1,11 +1,4 @@ -zeek_add_plugin( - Zeek - Pcap - SOURCES - Source.cc - Dumper.cc - Plugin.cc -) +zeek_add_plugin(Zeek Pcap SOURCES Source.cc Dumper.cc Plugin.cc) # Treat BIFs as builtin (alternative mode). bif_target(pcap.bif) diff --git a/src/logging/CMakeLists.txt b/src/logging/CMakeLists.txt index 581ea0013d..7690998520 100644 --- a/src/logging/CMakeLists.txt +++ b/src/logging/CMakeLists.txt @@ -1,12 +1,11 @@ zeek_add_subdir_library( logging SOURCES - Component.cc - Manager.cc - WriterBackend.cc - WriterFrontend.cc + Component.cc + Manager.cc + WriterBackend.cc + WriterFrontend.cc BIFS - logging.bif -) + logging.bif) add_subdirectory(writers) diff --git a/src/logging/writers/CMakeLists.txt b/src/logging/writers/CMakeLists.txt index 3aa507b316..1508535c34 100644 --- a/src/logging/writers/CMakeLists.txt +++ b/src/logging/writers/CMakeLists.txt @@ -1,6 +1,5 @@ - add_subdirectory(ascii) add_subdirectory(none) if (USE_SQLITE) add_subdirectory(sqlite) -endif() +endif () diff --git a/src/logging/writers/ascii/CMakeLists.txt b/src/logging/writers/ascii/CMakeLists.txt index 940b0ff6b0..b76d2f4265 100644 --- a/src/logging/writers/ascii/CMakeLists.txt +++ b/src/logging/writers/ascii/CMakeLists.txt @@ -1,9 +1,8 @@ zeek_add_plugin( Zeek - AsciiWriter + AsciiWriter SOURCES - Ascii.cc - Plugin.cc + Ascii.cc + Plugin.cc BIFS - ascii.bif -) + ascii.bif) diff --git a/src/logging/writers/none/CMakeLists.txt b/src/logging/writers/none/CMakeLists.txt index 40415927e1..a9466c1ece 100644 --- a/src/logging/writers/none/CMakeLists.txt +++ b/src/logging/writers/none/CMakeLists.txt @@ -2,8 +2,7 @@ zeek_add_plugin( Zeek NoneWriter SOURCES - None.cc - Plugin.cc + None.cc + Plugin.cc BIFS - none.bif -) + none.bif) diff --git a/src/logging/writers/sqlite/CMakeLists.txt b/src/logging/writers/sqlite/CMakeLists.txt index 7cbda35fc1..735ba8aec1 100644 --- a/src/logging/writers/sqlite/CMakeLists.txt +++ b/src/logging/writers/sqlite/CMakeLists.txt @@ -2,8 +2,7 @@ zeek_add_plugin( Zeek SQLiteWriter SOURCES - SQLite.cc - Plugin.cc + SQLite.cc + Plugin.cc BIFS - sqlite.bif -) + sqlite.bif) diff --git a/src/packet_analysis/CMakeLists.txt b/src/packet_analysis/CMakeLists.txt index 014cbe2755..f7e5f37491 100644 --- a/src/packet_analysis/CMakeLists.txt +++ b/src/packet_analysis/CMakeLists.txt @@ -1,11 +1,12 @@ zeek_add_subdir_library( packet_analysis - INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} + INCLUDE_DIRS + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} SOURCES - Analyzer.cc - Dispatcher.cc - Manager.cc - Component.cc -) + Analyzer.cc + Dispatcher.cc + Manager.cc + Component.cc) add_subdirectory(protocol) diff --git a/src/packet_analysis/protocol/arp/CMakeLists.txt b/src/packet_analysis/protocol/arp/CMakeLists.txt index 28d7533782..0a2a7b73da 100644 --- a/src/packet_analysis/protocol/arp/CMakeLists.txt +++ b/src/packet_analysis/protocol/arp/CMakeLists.txt @@ -2,8 +2,7 @@ zeek_add_plugin( Zeek ARP SOURCES - ARP.cc - Plugin.cc + ARP.cc + Plugin.cc BIFS - events.bif -) + events.bif) diff --git a/src/packet_analysis/protocol/ayiya/CMakeLists.txt b/src/packet_analysis/protocol/ayiya/CMakeLists.txt index 32f24f88d3..9e79abc894 100644 --- a/src/packet_analysis/protocol/ayiya/CMakeLists.txt +++ b/src/packet_analysis/protocol/ayiya/CMakeLists.txt @@ -1,7 +1 @@ -zeek_add_plugin( - Zeek - AYIYA - SOURCES - AYIYA.cc - Plugin.cc -) +zeek_add_plugin(Zeek AYIYA SOURCES AYIYA.cc Plugin.cc) diff --git a/src/packet_analysis/protocol/ethernet/CMakeLists.txt b/src/packet_analysis/protocol/ethernet/CMakeLists.txt index 8ac662c3b7..bd1577b9b2 100644 --- a/src/packet_analysis/protocol/ethernet/CMakeLists.txt +++ b/src/packet_analysis/protocol/ethernet/CMakeLists.txt @@ -1,7 +1 @@ -zeek_add_plugin( - PacketAnalyzer - Ethernet - SOURCES - Ethernet.cc - Plugin.cc -) +zeek_add_plugin(PacketAnalyzer Ethernet SOURCES Ethernet.cc Plugin.cc) diff --git a/src/packet_analysis/protocol/fddi/CMakeLists.txt b/src/packet_analysis/protocol/fddi/CMakeLists.txt index 40d4c00f90..1d1658a3ea 100644 --- a/src/packet_analysis/protocol/fddi/CMakeLists.txt +++ b/src/packet_analysis/protocol/fddi/CMakeLists.txt @@ -1,7 +1 @@ -zeek_add_plugin( - PacketAnalyzer - FDDI - SOURCES - FDDI.cc - Plugin.cc -) +zeek_add_plugin(PacketAnalyzer FDDI SOURCES FDDI.cc Plugin.cc) diff --git a/src/packet_analysis/protocol/geneve/CMakeLists.txt b/src/packet_analysis/protocol/geneve/CMakeLists.txt index c71f7c45f3..dbce4d0442 100644 --- a/src/packet_analysis/protocol/geneve/CMakeLists.txt +++ b/src/packet_analysis/protocol/geneve/CMakeLists.txt @@ -2,8 +2,7 @@ zeek_add_plugin( Zeek Geneve SOURCES - Geneve.cc - Plugin.cc + Geneve.cc + Plugin.cc BIFS - events.bif -) + events.bif) diff --git a/src/packet_analysis/protocol/gre/CMakeLists.txt b/src/packet_analysis/protocol/gre/CMakeLists.txt index c9b88e19b5..ad3585ed78 100644 --- a/src/packet_analysis/protocol/gre/CMakeLists.txt +++ b/src/packet_analysis/protocol/gre/CMakeLists.txt @@ -1,7 +1 @@ -zeek_add_plugin( - PacketAnalyzer - GRE - SOURCES - GRE.cc - Plugin.cc -) +zeek_add_plugin(PacketAnalyzer GRE SOURCES GRE.cc Plugin.cc) diff --git a/src/packet_analysis/protocol/gtpv1/CMakeLists.txt b/src/packet_analysis/protocol/gtpv1/CMakeLists.txt index 63fb5cf5d0..af1e3b15a8 100644 --- a/src/packet_analysis/protocol/gtpv1/CMakeLists.txt +++ b/src/packet_analysis/protocol/gtpv1/CMakeLists.txt @@ -2,13 +2,12 @@ zeek_add_plugin( Zeek GTPv1 SOURCES - GTPv1.cc - Plugin.cc + GTPv1.cc + Plugin.cc BIFS - events.bif - functions.bif + events.bif + functions.bif PAC - gtpv1.pac - gtpv1-protocol.pac - gtpv1-analyzer.pac -) + gtpv1.pac + gtpv1-protocol.pac + gtpv1-analyzer.pac) diff --git a/src/packet_analysis/protocol/icmp/CMakeLists.txt b/src/packet_analysis/protocol/icmp/CMakeLists.txt index 09cefa1b1b..f1b4f3cee9 100644 --- a/src/packet_analysis/protocol/icmp/CMakeLists.txt +++ b/src/packet_analysis/protocol/icmp/CMakeLists.txt @@ -2,9 +2,8 @@ zeek_add_plugin( Zeek ICMP SOURCES - ICMP.cc - ICMPSessionAdapter.cc - Plugin.cc + ICMP.cc + ICMPSessionAdapter.cc + Plugin.cc BIFS - events.bif -) + events.bif) diff --git a/src/packet_analysis/protocol/ieee802_11/CMakeLists.txt b/src/packet_analysis/protocol/ieee802_11/CMakeLists.txt index b246a23d74..0c2d46b31c 100644 --- a/src/packet_analysis/protocol/ieee802_11/CMakeLists.txt +++ b/src/packet_analysis/protocol/ieee802_11/CMakeLists.txt @@ -1,7 +1 @@ -zeek_add_plugin( - PacketAnalyzer - IEEE802_11 - SOURCES - IEEE802_11.cc - Plugin.cc -) +zeek_add_plugin(PacketAnalyzer IEEE802_11 SOURCES IEEE802_11.cc Plugin.cc) diff --git a/src/packet_analysis/protocol/ieee802_11_radio/CMakeLists.txt b/src/packet_analysis/protocol/ieee802_11_radio/CMakeLists.txt index 2a8b31f1c5..3cfb20083b 100644 --- a/src/packet_analysis/protocol/ieee802_11_radio/CMakeLists.txt +++ b/src/packet_analysis/protocol/ieee802_11_radio/CMakeLists.txt @@ -1,7 +1 @@ -zeek_add_plugin( - PacketAnalyzer - IEEE802_11_Radio - SOURCES - IEEE802_11_Radio.cc - Plugin.cc -) +zeek_add_plugin(PacketAnalyzer IEEE802_11_Radio SOURCES IEEE802_11_Radio.cc Plugin.cc) diff --git a/src/packet_analysis/protocol/ip/CMakeLists.txt b/src/packet_analysis/protocol/ip/CMakeLists.txt index 59a26a6d55..05b694c482 100644 --- a/src/packet_analysis/protocol/ip/CMakeLists.txt +++ b/src/packet_analysis/protocol/ip/CMakeLists.txt @@ -2,8 +2,7 @@ zeek_add_plugin( PacketAnalyzer IP SOURCES - IP.cc - IPBasedAnalyzer.cc - SessionAdapter.cc - Plugin.cc -) + IP.cc + IPBasedAnalyzer.cc + SessionAdapter.cc + Plugin.cc) diff --git a/src/packet_analysis/protocol/iptunnel/CMakeLists.txt b/src/packet_analysis/protocol/iptunnel/CMakeLists.txt index 6518d38758..01a680323e 100644 --- a/src/packet_analysis/protocol/iptunnel/CMakeLists.txt +++ b/src/packet_analysis/protocol/iptunnel/CMakeLists.txt @@ -1,7 +1 @@ -zeek_add_plugin( - PacketAnalyzer - IPTunnel - SOURCES - IPTunnel.cc - Plugin.cc -) +zeek_add_plugin(PacketAnalyzer IPTunnel SOURCES IPTunnel.cc Plugin.cc) diff --git a/src/packet_analysis/protocol/linux_sll/CMakeLists.txt b/src/packet_analysis/protocol/linux_sll/CMakeLists.txt index 3d517c53cd..2591b64160 100644 --- a/src/packet_analysis/protocol/linux_sll/CMakeLists.txt +++ b/src/packet_analysis/protocol/linux_sll/CMakeLists.txt @@ -1,7 +1 @@ -zeek_add_plugin( - PacketAnalyzer - LinuxSLL - SOURCES - LinuxSLL.cc - Plugin.cc -) +zeek_add_plugin(PacketAnalyzer LinuxSLL SOURCES LinuxSLL.cc Plugin.cc) diff --git a/src/packet_analysis/protocol/linux_sll2/CMakeLists.txt b/src/packet_analysis/protocol/linux_sll2/CMakeLists.txt index 63a94ca844..b3072fa4bb 100644 --- a/src/packet_analysis/protocol/linux_sll2/CMakeLists.txt +++ b/src/packet_analysis/protocol/linux_sll2/CMakeLists.txt @@ -1,7 +1 @@ -zeek_add_plugin( - PacketAnalyzer - LinuxSLL2 - SOURCES - LinuxSLL2.cc - Plugin.cc -) +zeek_add_plugin(PacketAnalyzer LinuxSLL2 SOURCES LinuxSLL2.cc Plugin.cc) diff --git a/src/packet_analysis/protocol/llc/CMakeLists.txt b/src/packet_analysis/protocol/llc/CMakeLists.txt index 4d974b9b0a..692f39e440 100644 --- a/src/packet_analysis/protocol/llc/CMakeLists.txt +++ b/src/packet_analysis/protocol/llc/CMakeLists.txt @@ -1,7 +1 @@ -zeek_add_plugin( - PacketAnalyzer - LLC - SOURCES - LLC.cc - Plugin.cc -) +zeek_add_plugin(PacketAnalyzer LLC SOURCES LLC.cc Plugin.cc) diff --git a/src/packet_analysis/protocol/mpls/CMakeLists.txt b/src/packet_analysis/protocol/mpls/CMakeLists.txt index 3e40d0fe16..8f14323b77 100644 --- a/src/packet_analysis/protocol/mpls/CMakeLists.txt +++ b/src/packet_analysis/protocol/mpls/CMakeLists.txt @@ -1,7 +1 @@ -zeek_add_plugin( - PacketAnalyzer - MPLS - SOURCES - MPLS.cc - Plugin.cc -) +zeek_add_plugin(PacketAnalyzer MPLS SOURCES MPLS.cc Plugin.cc) diff --git a/src/packet_analysis/protocol/nflog/CMakeLists.txt b/src/packet_analysis/protocol/nflog/CMakeLists.txt index 53239f2b6c..fad9feb3b7 100644 --- a/src/packet_analysis/protocol/nflog/CMakeLists.txt +++ b/src/packet_analysis/protocol/nflog/CMakeLists.txt @@ -1,7 +1 @@ -zeek_add_plugin( - PacketAnalyzer - NFLog - SOURCES - NFLog.cc - Plugin.cc -) +zeek_add_plugin(PacketAnalyzer NFLog SOURCES NFLog.cc Plugin.cc) diff --git a/src/packet_analysis/protocol/novell_802_3/CMakeLists.txt b/src/packet_analysis/protocol/novell_802_3/CMakeLists.txt index 0eb4592faa..9adb81f417 100644 --- a/src/packet_analysis/protocol/novell_802_3/CMakeLists.txt +++ b/src/packet_analysis/protocol/novell_802_3/CMakeLists.txt @@ -1,7 +1 @@ -zeek_add_plugin( - PacketAnalyzer - Novell_802_3 - SOURCES - Novell_802_3.cc - Plugin.cc -) +zeek_add_plugin(PacketAnalyzer Novell_802_3 SOURCES Novell_802_3.cc Plugin.cc) diff --git a/src/packet_analysis/protocol/null/CMakeLists.txt b/src/packet_analysis/protocol/null/CMakeLists.txt index dd0da51371..91e04f8d9d 100644 --- a/src/packet_analysis/protocol/null/CMakeLists.txt +++ b/src/packet_analysis/protocol/null/CMakeLists.txt @@ -1,7 +1 @@ -zeek_add_plugin( - PacketAnalyzer - Null - SOURCES - Null.cc - Plugin.cc -) +zeek_add_plugin(PacketAnalyzer Null SOURCES Null.cc Plugin.cc) diff --git a/src/packet_analysis/protocol/pbb/CMakeLists.txt b/src/packet_analysis/protocol/pbb/CMakeLists.txt index cee71edd44..3e6889369c 100644 --- a/src/packet_analysis/protocol/pbb/CMakeLists.txt +++ b/src/packet_analysis/protocol/pbb/CMakeLists.txt @@ -1,4 +1,3 @@ - include(ZeekPlugin) include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/src/packet_analysis/protocol/ppp_serial/CMakeLists.txt b/src/packet_analysis/protocol/ppp_serial/CMakeLists.txt index c6aa6f8f26..aa4ab35657 100644 --- a/src/packet_analysis/protocol/ppp_serial/CMakeLists.txt +++ b/src/packet_analysis/protocol/ppp_serial/CMakeLists.txt @@ -1,7 +1 @@ -zeek_add_plugin( - PacketAnalyzer - PPPSerial - SOURCES - PPPSerial.cc - Plugin.cc -) +zeek_add_plugin(PacketAnalyzer PPPSerial SOURCES PPPSerial.cc Plugin.cc) diff --git a/src/packet_analysis/protocol/pppoe/CMakeLists.txt b/src/packet_analysis/protocol/pppoe/CMakeLists.txt index 1173703493..d84229004a 100644 --- a/src/packet_analysis/protocol/pppoe/CMakeLists.txt +++ b/src/packet_analysis/protocol/pppoe/CMakeLists.txt @@ -1,7 +1 @@ -zeek_add_plugin( - PacketAnalyzer - PPPoE - SOURCES - PPPoE.cc - Plugin.cc -) +zeek_add_plugin(PacketAnalyzer PPPoE SOURCES PPPoE.cc Plugin.cc) diff --git a/src/packet_analysis/protocol/root/CMakeLists.txt b/src/packet_analysis/protocol/root/CMakeLists.txt index c127ad458f..cd4456cb6a 100644 --- a/src/packet_analysis/protocol/root/CMakeLists.txt +++ b/src/packet_analysis/protocol/root/CMakeLists.txt @@ -1,7 +1 @@ -zeek_add_plugin( - PacketAnalyzer - Root - SOURCES - Root.cc - Plugin.cc -) +zeek_add_plugin(PacketAnalyzer Root SOURCES Root.cc Plugin.cc) diff --git a/src/packet_analysis/protocol/skip/CMakeLists.txt b/src/packet_analysis/protocol/skip/CMakeLists.txt index 85cede467f..a8d4bc517a 100644 --- a/src/packet_analysis/protocol/skip/CMakeLists.txt +++ b/src/packet_analysis/protocol/skip/CMakeLists.txt @@ -1,7 +1 @@ -zeek_add_plugin( - PacketAnalyzer - Skip - SOURCES - Skip.cc - Plugin.cc -) +zeek_add_plugin(PacketAnalyzer Skip SOURCES Skip.cc Plugin.cc) diff --git a/src/packet_analysis/protocol/snap/CMakeLists.txt b/src/packet_analysis/protocol/snap/CMakeLists.txt index 7f6412cb4b..e064f3c395 100644 --- a/src/packet_analysis/protocol/snap/CMakeLists.txt +++ b/src/packet_analysis/protocol/snap/CMakeLists.txt @@ -1,7 +1 @@ -zeek_add_plugin( - PacketAnalyzer - SNAP - SOURCES - SNAP.cc - Plugin.cc -) +zeek_add_plugin(PacketAnalyzer SNAP SOURCES SNAP.cc Plugin.cc) diff --git a/src/packet_analysis/protocol/tcp/CMakeLists.txt b/src/packet_analysis/protocol/tcp/CMakeLists.txt index 6e9646a8bd..9935b63489 100644 --- a/src/packet_analysis/protocol/tcp/CMakeLists.txt +++ b/src/packet_analysis/protocol/tcp/CMakeLists.txt @@ -2,8 +2,7 @@ zeek_add_plugin( PacketAnalyzer TCP_PKT SOURCES - TCP.cc - TCPSessionAdapter.cc - Plugin.cc - Stats.cc -) + TCP.cc + TCPSessionAdapter.cc + Plugin.cc + Stats.cc) diff --git a/src/packet_analysis/protocol/teredo/CMakeLists.txt b/src/packet_analysis/protocol/teredo/CMakeLists.txt index 028864160e..dd5682b1f5 100644 --- a/src/packet_analysis/protocol/teredo/CMakeLists.txt +++ b/src/packet_analysis/protocol/teredo/CMakeLists.txt @@ -2,9 +2,8 @@ zeek_add_plugin( Zeek Teredo SOURCES - Teredo.cc - Plugin.cc + Teredo.cc + Plugin.cc BIFS - events.bif - functions.bif -) + events.bif + functions.bif) diff --git a/src/packet_analysis/protocol/udp/CMakeLists.txt b/src/packet_analysis/protocol/udp/CMakeLists.txt index 99a892a89c..3812077c37 100644 --- a/src/packet_analysis/protocol/udp/CMakeLists.txt +++ b/src/packet_analysis/protocol/udp/CMakeLists.txt @@ -2,9 +2,8 @@ zeek_add_plugin( Zeek UDP SOURCES - UDP.cc - UDPSessionAdapter.cc - Plugin.cc + UDP.cc + UDPSessionAdapter.cc + Plugin.cc BIFS - events.bif -) + events.bif) diff --git a/src/packet_analysis/protocol/vlan/CMakeLists.txt b/src/packet_analysis/protocol/vlan/CMakeLists.txt index ed37c128c4..afc2faab54 100644 --- a/src/packet_analysis/protocol/vlan/CMakeLists.txt +++ b/src/packet_analysis/protocol/vlan/CMakeLists.txt @@ -1,7 +1 @@ -zeek_add_plugin( - PacketAnalyzer - VLAN - SOURCES - VLAN.cc - Plugin.cc -) +zeek_add_plugin(PacketAnalyzer VLAN SOURCES VLAN.cc Plugin.cc) diff --git a/src/packet_analysis/protocol/vntag/CMakeLists.txt b/src/packet_analysis/protocol/vntag/CMakeLists.txt index 313d5b67bf..1143d525a7 100644 --- a/src/packet_analysis/protocol/vntag/CMakeLists.txt +++ b/src/packet_analysis/protocol/vntag/CMakeLists.txt @@ -1,7 +1 @@ -zeek_add_plugin( - PacketAnalyzer - VNTag - SOURCES - VNTag.cc - Plugin.cc -) +zeek_add_plugin(PacketAnalyzer VNTag SOURCES VNTag.cc Plugin.cc) diff --git a/src/packet_analysis/protocol/vxlan/CMakeLists.txt b/src/packet_analysis/protocol/vxlan/CMakeLists.txt index 81623727bb..5a077f50f8 100644 --- a/src/packet_analysis/protocol/vxlan/CMakeLists.txt +++ b/src/packet_analysis/protocol/vxlan/CMakeLists.txt @@ -2,8 +2,7 @@ zeek_add_plugin( Zeek VXLAN SOURCES - VXLAN.cc - Plugin.cc + VXLAN.cc + Plugin.cc BIFS - events.bif -) + events.bif) diff --git a/src/packet_analysis/protocol/wrapper/CMakeLists.txt b/src/packet_analysis/protocol/wrapper/CMakeLists.txt index 6c37e2e35b..aaac07bbb3 100644 --- a/src/packet_analysis/protocol/wrapper/CMakeLists.txt +++ b/src/packet_analysis/protocol/wrapper/CMakeLists.txt @@ -1,7 +1 @@ -zeek_add_plugin( - Zeek - Wrapper - SOURCES - Wrapper.cc - Plugin.cc -) +zeek_add_plugin(Zeek Wrapper SOURCES Wrapper.cc Plugin.cc) diff --git a/src/probabilistic/CMakeLists.txt b/src/probabilistic/CMakeLists.txt index f8f948aea3..9c5a6e72bd 100644 --- a/src/probabilistic/CMakeLists.txt +++ b/src/probabilistic/CMakeLists.txt @@ -1,14 +1,13 @@ zeek_add_subdir_library( probabilistic SOURCES - BitVector.cc - BloomFilter.cc - CardinalityCounter.cc - CounterVector.cc - Hasher.cc - Topk.cc + BitVector.cc + BloomFilter.cc + CardinalityCounter.cc + CounterVector.cc + Hasher.cc + Topk.cc BIFS - bloom-filter.bif - cardinality-counter.bif - top-k.bif -) + bloom-filter.bif + cardinality-counter.bif + top-k.bif) diff --git a/src/session/CMakeLists.txt b/src/session/CMakeLists.txt index 752db51cbb..0bd82de16e 100644 --- a/src/session/CMakeLists.txt +++ b/src/session/CMakeLists.txt @@ -1,7 +1 @@ -zeek_add_subdir_library( - session - SOURCES - Session.cc - Key.cc - Manager.cc -) +zeek_add_subdir_library(session SOURCES Session.cc Key.cc Manager.cc) diff --git a/src/telemetry/CMakeLists.txt b/src/telemetry/CMakeLists.txt index b93bf72a1b..1c71ba42a3 100644 --- a/src/telemetry/CMakeLists.txt +++ b/src/telemetry/CMakeLists.txt @@ -1,7 +1 @@ -zeek_add_subdir_library( - telemetry - SOURCES - Manager.cc - BIFS - telemetry.bif -) +zeek_add_subdir_library(telemetry SOURCES Manager.cc BIFS telemetry.bif) diff --git a/src/zeekygen/CMakeLists.txt b/src/zeekygen/CMakeLists.txt index eee80e8a65..6095ed6757 100644 --- a/src/zeekygen/CMakeLists.txt +++ b/src/zeekygen/CMakeLists.txt @@ -1,16 +1,15 @@ zeek_add_subdir_library( zeekygen SOURCES - Manager.cc - Info.h - PackageInfo.cc - ScriptInfo.cc - IdentifierInfo.cc - Target.cc - Configuration.cc - ReStructuredTextTable.cc - utils.cc -) + Manager.cc + Info.h + PackageInfo.cc + ScriptInfo.cc + IdentifierInfo.cc + Target.cc + Configuration.cc + ReStructuredTextTable.cc + utils.cc) # Treat BIFs as builtin (alternative mode). bif_target(zeekygen.bif) diff --git a/testing/CMakeLists.txt b/testing/CMakeLists.txt index 7ae503924f..0ed2fa2cf0 100644 --- a/testing/CMakeLists.txt +++ b/testing/CMakeLists.txt @@ -1,8 +1,10 @@ -install(DIRECTORY scripts/ DESTINATION ${ZEEK_CONFIG_BTEST_TOOLS_DIR}/scripts - USE_SOURCE_PERMISSIONS - FILES_MATCHING PATTERN "diff-*") +install( + DIRECTORY scripts/ + DESTINATION ${ZEEK_CONFIG_BTEST_TOOLS_DIR}/scripts + USE_SOURCE_PERMISSIONS FILES_MATCHING + PATTERN "diff-*") install(FILES btest/random.seed DESTINATION ${ZEEK_CONFIG_BTEST_TOOLS_DIR}/data) -if ( INSTALL_BTEST_PCAPS ) +if (INSTALL_BTEST_PCAPS) install(DIRECTORY btest/Traces/ DESTINATION ${ZEEK_CONFIG_BTEST_TOOLS_DIR}/data/pcaps) endif () diff --git a/testing/btest/plugins/binpac-flowbuffer-frame-length-plugin/CMakeLists.txt b/testing/btest/plugins/binpac-flowbuffer-frame-length-plugin/CMakeLists.txt index 9632726412..0a0badaf74 100644 --- a/testing/btest/plugins/binpac-flowbuffer-frame-length-plugin/CMakeLists.txt +++ b/testing/btest/plugins/binpac-flowbuffer-frame-length-plugin/CMakeLists.txt @@ -1,9 +1,8 @@ - project(Zeek-Plugin-Foo-FOO) cmake_minimum_required(VERSION 3.5) -if ( NOT ZEEK_DIST ) +if (NOT ZEEK_DIST) message(FATAL_ERROR "ZEEK_DIST not set") endif () diff --git a/testing/btest/plugins/conflict-plugin/CMakeLists.txt b/testing/btest/plugins/conflict-plugin/CMakeLists.txt index 7864acc7d1..7cfa0fdab2 100644 --- a/testing/btest/plugins/conflict-plugin/CMakeLists.txt +++ b/testing/btest/plugins/conflict-plugin/CMakeLists.txt @@ -1,9 +1,8 @@ - project(Zeek-Plugin-Conflict-Plugin) cmake_minimum_required(VERSION 3.5) -if ( NOT ZEEK_DIST ) +if (NOT ZEEK_DIST) message(FATAL_ERROR "ZEEK_DIST not set") endif () diff --git a/testing/btest/plugins/file-plugin/CMakeLists.txt b/testing/btest/plugins/file-plugin/CMakeLists.txt index 6fc782e2ca..d41f1b3c51 100644 --- a/testing/btest/plugins/file-plugin/CMakeLists.txt +++ b/testing/btest/plugins/file-plugin/CMakeLists.txt @@ -1,9 +1,8 @@ - project(Zeek-Plugin-Demo-Foo) cmake_minimum_required(VERSION 3.5) -if ( NOT BRO_DIST ) +if (NOT BRO_DIST) message(FATAL_ERROR "BRO_DIST not set") endif () diff --git a/testing/btest/plugins/packet-protocol-plugin/CMakeLists.txt b/testing/btest/plugins/packet-protocol-plugin/CMakeLists.txt index 99604aeb2b..b83bc5526a 100644 --- a/testing/btest/plugins/packet-protocol-plugin/CMakeLists.txt +++ b/testing/btest/plugins/packet-protocol-plugin/CMakeLists.txt @@ -1,9 +1,8 @@ - project(Zeek-Packet-Plugin-Demo) cmake_minimum_required(VERSION 3.5) -if ( NOT ZEEK_DIST ) +if (NOT ZEEK_DIST) message(FATAL_ERROR "ZEEK_DIST not set") endif () diff --git a/testing/btest/plugins/pktdumper-plugin/CMakeLists.txt b/testing/btest/plugins/pktdumper-plugin/CMakeLists.txt index f611ab6b80..2ada85d2ef 100644 --- a/testing/btest/plugins/pktdumper-plugin/CMakeLists.txt +++ b/testing/btest/plugins/pktdumper-plugin/CMakeLists.txt @@ -1,9 +1,8 @@ - project(Zeek-Plugin-Demo-Foo) cmake_minimum_required(VERSION 3.5) -if ( NOT ZEEK_DIST ) +if (NOT ZEEK_DIST) message(FATAL_ERROR "ZEEK_DIST not set") endif () diff --git a/testing/btest/plugins/pktsrc-plugin/CMakeLists.txt b/testing/btest/plugins/pktsrc-plugin/CMakeLists.txt index f611ab6b80..2ada85d2ef 100644 --- a/testing/btest/plugins/pktsrc-plugin/CMakeLists.txt +++ b/testing/btest/plugins/pktsrc-plugin/CMakeLists.txt @@ -1,9 +1,8 @@ - project(Zeek-Plugin-Demo-Foo) cmake_minimum_required(VERSION 3.5) -if ( NOT ZEEK_DIST ) +if (NOT ZEEK_DIST) message(FATAL_ERROR "ZEEK_DIST not set") endif () diff --git a/testing/btest/plugins/protocol-plugin/CMakeLists.txt b/testing/btest/plugins/protocol-plugin/CMakeLists.txt index 53a50f3961..c7e685cd1e 100644 --- a/testing/btest/plugins/protocol-plugin/CMakeLists.txt +++ b/testing/btest/plugins/protocol-plugin/CMakeLists.txt @@ -1,9 +1,8 @@ - project(Zeek-Plugin-Demo-Foo) cmake_minimum_required(VERSION 3.5) -if ( NOT ZEEK_DIST ) +if (NOT ZEEK_DIST) message(FATAL_ERROR "ZEEK_DIST not set") endif () diff --git a/testing/btest/plugins/reader-plugin/CMakeLists.txt b/testing/btest/plugins/reader-plugin/CMakeLists.txt index f611ab6b80..2ada85d2ef 100644 --- a/testing/btest/plugins/reader-plugin/CMakeLists.txt +++ b/testing/btest/plugins/reader-plugin/CMakeLists.txt @@ -1,9 +1,8 @@ - project(Zeek-Plugin-Demo-Foo) cmake_minimum_required(VERSION 3.5) -if ( NOT ZEEK_DIST ) +if (NOT ZEEK_DIST) message(FATAL_ERROR "ZEEK_DIST not set") endif () diff --git a/testing/btest/plugins/writer-plugin/CMakeLists.txt b/testing/btest/plugins/writer-plugin/CMakeLists.txt index f611ab6b80..2ada85d2ef 100644 --- a/testing/btest/plugins/writer-plugin/CMakeLists.txt +++ b/testing/btest/plugins/writer-plugin/CMakeLists.txt @@ -1,9 +1,8 @@ - project(Zeek-Plugin-Demo-Foo) cmake_minimum_required(VERSION 3.5) -if ( NOT ZEEK_DIST ) +if (NOT ZEEK_DIST) message(FATAL_ERROR "ZEEK_DIST not set") endif () diff --git a/testing/builtin-plugins/Files/protocol-plugin/CMakeLists.txt b/testing/builtin-plugins/Files/protocol-plugin/CMakeLists.txt index 53a50f3961..c7e685cd1e 100644 --- a/testing/builtin-plugins/Files/protocol-plugin/CMakeLists.txt +++ b/testing/builtin-plugins/Files/protocol-plugin/CMakeLists.txt @@ -1,9 +1,8 @@ - project(Zeek-Plugin-Demo-Foo) cmake_minimum_required(VERSION 3.5) -if ( NOT ZEEK_DIST ) +if (NOT ZEEK_DIST) message(FATAL_ERROR "ZEEK_DIST not set") endif () diff --git a/testing/builtin-plugins/Files/py-lib-plugin/CMakeLists.txt b/testing/builtin-plugins/Files/py-lib-plugin/CMakeLists.txt index ce8eb32c96..76936614fa 100644 --- a/testing/builtin-plugins/Files/py-lib-plugin/CMakeLists.txt +++ b/testing/builtin-plugins/Files/py-lib-plugin/CMakeLists.txt @@ -20,12 +20,12 @@ include_directories(BEFORE ${PYTHON_INCLUDE_DIR}) zeek_plugin_begin(Zeek PyLib) file(GLOB cc_files RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "plugin/src/*.cc") -foreach(file ${cc_files}) +foreach (file ${cc_files}) zeek_plugin_cc(${file}) endforeach () file(GLOB bif_files RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "plugin/src/*.bif") -foreach(file ${bif_files}) +foreach (file ${bif_files}) zeek_plugin_bif(${file}) endforeach () diff --git a/testing/builtin-plugins/Files/zeek-version-plugin/CMakeLists.txt b/testing/builtin-plugins/Files/zeek-version-plugin/CMakeLists.txt index e2637688d3..431677ab2b 100644 --- a/testing/builtin-plugins/Files/zeek-version-plugin/CMakeLists.txt +++ b/testing/builtin-plugins/Files/zeek-version-plugin/CMakeLists.txt @@ -1,9 +1,8 @@ - project(Zeek-Plugin-Demo-Version) cmake_minimum_required(VERSION 3.15) -if ( NOT ZEEK_DIST ) +if (NOT ZEEK_DIST) message(FATAL_ERROR "ZEEK_DIST not set") endif ()