Fix builds with plugins that use zeek-config

When building plugins externally with `zeek-config` (as opposed to using
`ZEEK_DIST`), they point into the install prefix. There, we add a new
file `ZeekPluginBootstrap.cmake` that helps `ZeekPlugin.cmake` to find
everything else it needs from there.

Our template for plugins generates a `configure` script that sets
various variables with values from `zeek-config`. We only need
`BROKER_ROOT_DIR` with the new bootstrapping logic. Everything else, we
can get from the new bootstrapping file and from the CMake package file
for Zeek.
This commit is contained in:
Dominik Charousset 2023-04-15 00:08:42 +02:00
parent 75245bd365
commit 1d81fb4fb0
5 changed files with 51 additions and 24 deletions

View file

@ -6,10 +6,16 @@
include(MacDependencyPaths)
# For finding zeek-plugin-create-package.sh and zeek-plugin-install-package.sh.
set(ZEEK_PLUGIN_SCRIPTS_PATH "@ZEEK_PLUGIN_SCRIPTS_PATH@")
if ( NOT ZEEK_PLUGIN_SCRIPTS_PATH )
set(ZEEK_PLUGIN_SCRIPTS_PATH "@ZEEK_PLUGIN_SCRIPTS_PATH@"
CACHE PATH "Path to utility shell scripts." FORCE)
endif ()
# For finding Zeek sources.
set(ZEEK_SOURCE_DIR "@ZEEK_SOURCE_DIR@")
if ( NOT ZEEK_SOURCE_DIR )
set(ZEEK_SOURCE_DIR "@ZEEK_SOURCE_DIR@"
CACHE PATH "Path to the Zeek source tree." FORCE)
endif ()
# Provide a hint to ZeekConfig.cmake where to find Broker from the build tree.
# Note: the straightforward way would be setting `Broker_ROOT` instead, but