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

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