Propagate zeek-version.h skip via CMake properties

Add a define for `ZEEK_CONFIG_SKIP_VERSION_H` to static plugins as well
as to dynamic plugins that we build alongside Zeek. When including
`zeek-config.h` with this macro defined, the header skips including
`zeek-version.h`.
This commit is contained in:
Dominik Charousset 2023-04-22 17:45:23 +02:00
parent 3f0eee5d9d
commit 1715028986
3 changed files with 15 additions and 15 deletions

2
cmake

@ -1 +1 @@
Subproject commit 6fd9b7405a2ee5c62e1a4d70ee47da8ca8bacb9a
Subproject commit 600bb015c0d5029c228a16bf052bd30c6af9ee10

View file

@ -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/)

View file

@ -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__)