diff --git a/cmake b/cmake index 6fd9b7405a..600bb015c0 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit 6fd9b7405a2ee5c62e1a4d70ee47da8ca8bacb9a +Subproject commit 600bb015c0d5029c228a16bf052bd30c6af9ee10 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 64f0577e42..408bc4a944 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -202,14 +202,23 @@ file(WRITE ${PRELOAD_SCRIPT} "# Warning, this is an autogenerated file!\n") set(LOAD_SCRIPT ${PROJECT_BINARY_DIR}/scripts/builtin-plugins/__load__.zeek) file(WRITE ${LOAD_SCRIPT} "# Warning, this is an autogenerated file!\n") -foreach (plugin_dir ${BUILTIN_PLUGIN_LIST}) - get_filename_component(plugin_name ${plugin_dir} NAME) +function(add_extra_builtin_plugin plugin_dir) + get_filename_component(plugin_name "${plugin_dir}" NAME) if(IS_DIRECTORY "${plugin_dir}/cmake") - set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${plugin_dir}/cmake") + list(APPEND CMAKE_MODULE_PATH "${plugin_dir}/cmake") 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 + # will tell CMake to *not* define ZEEK_CONFIG_SKIP_VERSION_H for the plugin. + set(ZEEK_BUILDING_EXTRA_PLUGINS ON) + add_subdirectory(${plugin_dir} ${CMAKE_CURRENT_BINARY_DIR}/builtin-plugins/${plugin_name}) +endfunction() + +foreach (plugin_dir ${BUILTIN_PLUGIN_LIST}) + add_extra_builtin_plugin("${plugin_dir}") endforeach() install(FILES ${PRELOAD_SCRIPT} DESTINATION ${ZEEK_SCRIPT_INSTALL_PATH}/builtin-plugins/) diff --git a/zeek-config.h.in b/zeek-config.h.in index a681e5fa5d..e79286e3be 100644 --- a/zeek-config.h.in +++ b/zeek-config.h.in @@ -248,19 +248,10 @@ /* String with extension of dynamic libraries (e.g., ".so") */ #define DYNAMIC_PLUGIN_SUFFIX "@CMAKE_SHARED_MODULE_SUFFIX@" -/* Set if we're building outside of the main Zeek source code tree. */ -#ifndef ZEEK_PLUGIN_INTERNAL_BUILD -#define ZEEK_PLUGIN_INTERNAL_BUILD true -#else -// Backwards compat for external plugins, include the version -// identifiers through zeek/zeek-version.h. -#if ! ZEEK_PLUGIN_INTERNAL_BUILD +// For builtin plugins, we don't want to include zeek-version.h. +#ifndef ZEEK_CONFIG_SKIP_VERSION_H #include "zeek/zeek-version.h" #endif -// -// Not sure we can ever deprecate this without changing -// the names. -#endif // GCC uses __SANITIZE_ADDRESS__, Clang uses __has_feature #if defined(__SANITIZE_ADDRESS__)