mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Merge remote-tracking branch 'origin/topic/neverlord/gh-2953'
* origin/topic/neverlord/gh-2953: Improve CMake variables, update cmake submodule Fix builds with plugins that use zeek-config Bumped cmake and used update-changes with explicit -p because it wasn't detecting the right commit to start with. Suspect something went off with the last bump.
This commit is contained in:
commit
683cb80f61
7 changed files with 72 additions and 25 deletions
17
CHANGES
17
CHANGES
|
@ -1,3 +1,20 @@
|
||||||
|
6.0.0-dev.376 | 2023-04-19 10:14:02 +0200
|
||||||
|
|
||||||
|
* Improve CMake variables, update cmake submodule (Dominik Charousset, Corelight)
|
||||||
|
|
||||||
|
* Fix builds with plugins that use zeek-config (Dominik Charousset, Corelight)
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
6.0.0-dev.373 | 2023-04-18 11:11:44 -0700
|
6.0.0-dev.373 | 2023-04-18 11:11:44 -0700
|
||||||
|
|
||||||
* log-caching-cluster: Wait for X509::known_log_certs to populate (Arne Welzel, Corelight)
|
* log-caching-cluster: Wait for X509::known_log_certs to populate (Arne Welzel, Corelight)
|
||||||
|
|
|
@ -13,6 +13,7 @@ option(ZEEK_STANDALONE "Build Zeek as stand-alone binary?" ON)
|
||||||
option(ENABLE_ZEEK_UNIT_TESTS "Build the C++ (doctest) unit tests?" ON)
|
option(ENABLE_ZEEK_UNIT_TESTS "Build the C++ (doctest) unit tests?" ON)
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON
|
||||||
CACHE INTERNAL "Write JSON compile commands database")
|
CACHE INTERNAL "Write JSON compile commands database")
|
||||||
|
set(ZEEK_CXX_STD cxx_std_17 CACHE STRING "The C++ standard to use.")
|
||||||
|
|
||||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR})
|
list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR})
|
||||||
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR})
|
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR})
|
||||||
|
@ -133,7 +134,7 @@ add_library(zeek_internal INTERFACE)
|
||||||
add_library(Zeek::Internal ALIAS zeek_internal)
|
add_library(Zeek::Internal ALIAS zeek_internal)
|
||||||
set_target_properties(zeek_internal PROPERTIES EXPORT_NAME Internal)
|
set_target_properties(zeek_internal PROPERTIES EXPORT_NAME Internal)
|
||||||
install(TARGETS zeek_internal EXPORT ZeekTargets)
|
install(TARGETS zeek_internal EXPORT ZeekTargets)
|
||||||
target_compile_features(zeek_internal INTERFACE cxx_std_17)
|
target_compile_features(zeek_internal INTERFACE ${ZEEK_CXX_STD})
|
||||||
|
|
||||||
# Target for bundling the creation of auto-generated files.
|
# Target for bundling the creation of auto-generated files.
|
||||||
add_custom_target(zeek_autogen_files)
|
add_custom_target(zeek_autogen_files)
|
||||||
|
@ -212,25 +213,24 @@ function(zeek_add_dependencies dep)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
# Interface library for propagating extra flags and include paths to dynamically
|
# Interface library for propagating extra flags and include paths to dynamically
|
||||||
# loaded plugins.
|
# loaded plugins. Also propagates include paths and C++17 mode on the install
|
||||||
|
# interface.
|
||||||
add_library(zeek_dynamic_plugin_base INTERFACE)
|
add_library(zeek_dynamic_plugin_base INTERFACE)
|
||||||
target_link_libraries(zeek_dynamic_plugin_base
|
target_link_libraries(zeek_dynamic_plugin_base
|
||||||
INTERFACE
|
INTERFACE
|
||||||
$<BUILD_INTERFACE:zeek_internal>)
|
$<BUILD_INTERFACE:zeek_internal>)
|
||||||
target_include_directories(zeek_dynamic_plugin_base
|
target_include_directories(zeek_dynamic_plugin_base
|
||||||
INTERFACE
|
INTERFACE
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
|
$<INSTALL_INTERFACE:include>
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>)
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>)
|
||||||
|
target_compile_features(zeek_dynamic_plugin_base INTERFACE ${ZEEK_CXX_STD})
|
||||||
add_library(Zeek::DynamicPluginBase ALIAS zeek_dynamic_plugin_base)
|
add_library(Zeek::DynamicPluginBase ALIAS zeek_dynamic_plugin_base)
|
||||||
set_target_properties(
|
set_target_properties(
|
||||||
zeek_dynamic_plugin_base PROPERTIES
|
zeek_dynamic_plugin_base PROPERTIES
|
||||||
EXPORT_NAME DynamicPluginBase)
|
EXPORT_NAME DynamicPluginBase)
|
||||||
install(TARGETS zeek_dynamic_plugin_base EXPORT ZeekTargets)
|
install(TARGETS zeek_dynamic_plugin_base EXPORT ZeekTargets)
|
||||||
|
|
||||||
# Tell dynamic plugins where to find scripts such as
|
|
||||||
# zeek-plugin-create-package.sh.
|
|
||||||
set(ZEEK_PLUGIN_SCRIPTS_PATH "${PROJECT_SOURCE_DIR}/cmake")
|
|
||||||
|
|
||||||
# On macOS, we need to tell the linker that the modules are allowed to have
|
# On macOS, we need to tell the linker that the modules are allowed to have
|
||||||
# undefined symbols.
|
# undefined symbols.
|
||||||
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||||
|
@ -435,6 +435,9 @@ if ( MSVC )
|
||||||
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 ()
|
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)
|
set(ZEEK_ETC_INSTALL_DIR ${ZEEK_ROOT_DIR}/etc)
|
||||||
endif ()
|
endif ()
|
||||||
|
@ -501,6 +504,7 @@ 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")
|
set(VERSION_C_IDENT "${VERSION_C_IDENT}_debug")
|
||||||
target_compile_definitions(zeek_internal INTERFACE DEBUG)
|
target_compile_definitions(zeek_internal INTERFACE DEBUG)
|
||||||
|
target_compile_definitions(zeek_dynamic_plugin_base INTERFACE DEBUG)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if ( NOT BINARY_PACKAGING_MODE )
|
if ( NOT BINARY_PACKAGING_MODE )
|
||||||
|
@ -1290,7 +1294,7 @@ configure_file(src/ZeekPluginConfig.cmake.in ZeekPluginConfig.cmake @ONLY)
|
||||||
configure_package_config_file(
|
configure_package_config_file(
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/ZeekConfig.cmake.in"
|
"${CMAKE_CURRENT_SOURCE_DIR}/src/ZeekConfig.cmake.in"
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/ZeekConfig.cmake"
|
"${CMAKE_CURRENT_BINARY_DIR}/ZeekConfig.cmake"
|
||||||
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Zeek")
|
INSTALL_DESTINATION "${ZEEK_CMAKE_CONFIG_DIR}")
|
||||||
write_basic_package_version_file(
|
write_basic_package_version_file(
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/ZeekConfigVersion.cmake"
|
"${CMAKE_CURRENT_BINARY_DIR}/ZeekConfigVersion.cmake"
|
||||||
VERSION ${ZEEK_VERSION_NUMBER}
|
VERSION ${ZEEK_VERSION_NUMBER}
|
||||||
|
@ -1299,17 +1303,22 @@ write_basic_package_version_file(
|
||||||
# Write the CMake targets file.
|
# Write the CMake targets file.
|
||||||
export(EXPORT ZeekTargets FILE ZeekTargets.cmake NAMESPACE Zeek::)
|
export(EXPORT ZeekTargets FILE ZeekTargets.cmake NAMESPACE Zeek::)
|
||||||
|
|
||||||
# TODO: Check whether installing these does not break any of our packages.
|
# Write the bootstrap file for dynamic plugins. Needed by ZeekPlugin.cmake.
|
||||||
# install(
|
configure_file(src/ZeekPluginBootstrap.cmake.in ZeekPluginBootstrap.cmake @ONLY)
|
||||||
# FILES
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ZeekPluginBootstrap.cmake"
|
||||||
# "${CMAKE_CURRENT_BINARY_DIR}/ZeekConfig.cmake"
|
DESTINATION "${ZEEK_CMAKE_CONFIG_DIR}")
|
||||||
# "${CMAKE_CURRENT_BINARY_DIR}/ZeekConfigVersion.cmake"
|
|
||||||
# DESTINATION
|
install(
|
||||||
# "${CMAKE_INSTALL_LIBDIR}/cmake/Zeek")
|
FILES
|
||||||
# install(
|
"${CMAKE_CURRENT_BINARY_DIR}/ZeekConfig.cmake"
|
||||||
# EXPORT ZeekTargets
|
"${CMAKE_CURRENT_BINARY_DIR}/ZeekConfigVersion.cmake"
|
||||||
# DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Zeek"
|
DESTINATION
|
||||||
# NAMESPACE Zeek::)
|
"${ZEEK_CMAKE_CONFIG_DIR}")
|
||||||
|
|
||||||
|
install(
|
||||||
|
EXPORT ZeekTargets
|
||||||
|
DESTINATION "${ZEEK_CMAKE_CONFIG_DIR}"
|
||||||
|
NAMESPACE Zeek::)
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
## Build Summary
|
## Build Summary
|
||||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
6.0.0-dev.373
|
6.0.0-dev.376
|
||||||
|
|
2
cmake
2
cmake
|
@ -1 +1 @@
|
||||||
Subproject commit f258c75659cec6e5dbd91ea18e21bc5dfad284a2
|
Subproject commit 6fd9b7405a2ee5c62e1a4d70ee47da8ca8bacb9a
|
15
src/ZeekPluginBootstrap.cmake.in
Normal file
15
src/ZeekPluginBootstrap.cmake.in
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
# This script is installed alongside ZeekPlugin.cmake for passing variables from
|
||||||
|
# the CMake configuration step to plugins.
|
||||||
|
|
||||||
|
# Allows scripts such as ZeekPlugin.cmake to locate the Zeek CMake package.
|
||||||
|
set(ZEEK_CMAKE_CONFIG_DIR "@ZEEK_CMAKE_CONFIG_DIR@"
|
||||||
|
CACHE PATH "Internal Zeek variable: the CMake package path for Zeek." FORCE)
|
||||||
|
|
||||||
|
# Allows scripts to locate files in the Zeek install tree.
|
||||||
|
set(ZEEK_CMAKE_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@"
|
||||||
|
CACHE PATH "Internal Zeek variable: CMAKE_INSTALL_PREFIX of Zeek." FORCE)
|
||||||
|
|
||||||
|
# Set ZEEK_PLUGIN_SCRIPTS_PATH for ZeekPlugin.cmake. We install the scripts into
|
||||||
|
# the package directory.
|
||||||
|
set(ZEEK_PLUGIN_SCRIPTS_PATH "${ZEEK_CMAKE_CONFIG_DIR}"
|
||||||
|
CACHE PATH "Path to utility scripts for building Zeek plugins." FORCE)
|
|
@ -6,10 +6,16 @@
|
||||||
include(MacDependencyPaths)
|
include(MacDependencyPaths)
|
||||||
|
|
||||||
# For finding zeek-plugin-create-package.sh and zeek-plugin-install-package.sh.
|
# 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.
|
# 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.
|
# 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
|
# Note: the straightforward way would be setting `Broker_ROOT` instead, but
|
||||||
|
|
|
@ -4,7 +4,7 @@ binpac_root=@ZEEK_CONFIG_BINPAC_ROOT_DIR@
|
||||||
broker_root=@ZEEK_CONFIG_BROKER_ROOT_DIR@
|
broker_root=@ZEEK_CONFIG_BROKER_ROOT_DIR@
|
||||||
btest_tools_dir=@ZEEK_CONFIG_BTEST_TOOLS_DIR@
|
btest_tools_dir=@ZEEK_CONFIG_BTEST_TOOLS_DIR@
|
||||||
build_type=@CMAKE_BUILD_TYPE_LOWER@
|
build_type=@CMAKE_BUILD_TYPE_LOWER@
|
||||||
cmake_dir=@CMAKE_INSTALL_PREFIX@/share/zeek/cmake
|
cmake_dir=@ZEEK_CMAKE_CONFIG_DIR@
|
||||||
config_dir=@ZEEK_ETC_INSTALL_DIR@
|
config_dir=@ZEEK_ETC_INSTALL_DIR@
|
||||||
have_spicy=@USE_SPICY_ANALYZERS@
|
have_spicy=@USE_SPICY_ANALYZERS@
|
||||||
include_dir=@CMAKE_INSTALL_PREFIX@/include
|
include_dir=@CMAKE_INSTALL_PREFIX@/include
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue