Move CMake template files to separate directory

This commit is contained in:
Tim Wojtulewicz 2023-06-26 10:20:56 -07:00
parent 64ebdec438
commit 25da02fe50
12 changed files with 29 additions and 26 deletions

View file

@ -464,7 +464,8 @@ set(zeek_script_install_path "${ZEEK_SCRIPT_INSTALL_PATH}")
if (MSVC) if (MSVC)
# This has to happen before we modify the paths below so that the pure Windows # This has to happen before we modify the paths below so that the pure Windows
# paths are stored in the output file. # paths are stored in the output file.
configure_file(zeek-path-dev.bat.in ${CMAKE_CURRENT_BINARY_DIR}/zeek-path-dev.bat) configure_file(cmake_templates/zeek-path-dev.bat.in
${CMAKE_CURRENT_BINARY_DIR}/zeek-path-dev.bat)
string(REGEX REPLACE "^([A-Za-z]):/(.*)" "/\\1/\\2" cmake_binary_dir "${cmake_binary_dir}") string(REGEX REPLACE "^([A-Za-z]):/(.*)" "/\\1/\\2" cmake_binary_dir "${cmake_binary_dir}")
string(REGEX REPLACE "^([A-Za-z]):/(.*)" "/\\1/\\2" cmake_current_binary_dir string(REGEX REPLACE "^([A-Za-z]):/(.*)" "/\\1/\\2" cmake_current_binary_dir
@ -504,7 +505,7 @@ install(DIRECTORY DESTINATION ${ZEEK_STATE_DIR})
install(DIRECTORY DESTINATION ${ZEEK_SPOOL_DIR}) install(DIRECTORY DESTINATION ${ZEEK_SPOOL_DIR})
install(DIRECTORY DESTINATION ${ZEEK_LOG_DIR}) install(DIRECTORY DESTINATION ${ZEEK_LOG_DIR})
configure_file(zeek-path-dev.in ${CMAKE_CURRENT_BINARY_DIR}/zeek-path-dev) configure_file(cmake_templates/zeek-path-dev.in ${CMAKE_CURRENT_BINARY_DIR}/zeek-path-dev)
file( file(
WRITE ${CMAKE_CURRENT_BINARY_DIR}/zeek-path-dev.sh WRITE ${CMAKE_CURRENT_BINARY_DIR}/zeek-path-dev.sh
@ -1154,8 +1155,8 @@ endif ()
set(ZEEK_CONFIG_BTEST_TOOLS_DIR ${ZEEK_ROOT_DIR}/share/btest) set(ZEEK_CONFIG_BTEST_TOOLS_DIR ${ZEEK_ROOT_DIR}/share/btest)
install(DIRECTORY DESTINATION ${ZEEK_CONFIG_BTEST_TOOLS_DIR}) install(DIRECTORY DESTINATION ${ZEEK_CONFIG_BTEST_TOOLS_DIR})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/zeek-config.in ${CMAKE_CURRENT_BINARY_DIR}/zeek-config configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake_templates/zeek-config.in
@ONLY) ${CMAKE_CURRENT_BINARY_DIR}/zeek-config @ONLY)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/zeek-config DESTINATION bin) install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/zeek-config DESTINATION bin)
install( install(
@ -1179,8 +1180,8 @@ if (INSTALL_ZKG)
set(ZEEK_ZKG_CONFIG_DIR "${ZEEK_ETC_INSTALL_DIR}/zkg") set(ZEEK_ZKG_CONFIG_DIR "${ZEEK_ETC_INSTALL_DIR}/zkg")
set(ZEEK_ZKG_STATE_DIR "${ZEEK_STATE_DIR}/zkg") set(ZEEK_ZKG_STATE_DIR "${ZEEK_STATE_DIR}/zkg")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/zkg-config.in ${CMAKE_CURRENT_BINARY_DIR}/zkg-config configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake_templates/zkg-config.in
@ONLY) ${CMAKE_CURRENT_BINARY_DIR}/zkg-config @ONLY)
install(DIRECTORY DESTINATION var/lib/zkg) install(DIRECTORY DESTINATION var/lib/zkg)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/zkg-config DESTINATION ${ZEEK_ZKG_CONFIG_DIR} install(FILES ${CMAKE_CURRENT_BINARY_DIR}/zkg-config DESTINATION ${ZEEK_ZKG_CONFIG_DIR}
@ -1270,19 +1271,20 @@ checkoptionalbuildsources(auxil/zeek-client ZeekClient INSTALL_ZEEK_CLIENT)
# Generate Spicy helper scripts referenced in e.g., `zeek-path-dev.*`. These # Generate Spicy helper scripts referenced in e.g., `zeek-path-dev.*`. These
# set Spicy-side environment variables to run it out of the build directory. # set Spicy-side environment variables to run it out of the build directory.
configure_file(${CMAKE_SOURCE_DIR}/spicy-path.in ${CMAKE_BINARY_DIR}/spicy-path @ONLY) configure_file(${CMAKE_SOURCE_DIR}/cmake_templates/spicy-path.in ${CMAKE_BINARY_DIR}/spicy-path
configure_file(${CMAKE_SOURCE_DIR}/hilti-cxx-include-dirs.in @ONLY)
configure_file(${CMAKE_SOURCE_DIR}/cmake_templates/hilti-cxx-include-dirs.in
${CMAKE_BINARY_DIR}/hilti-cxx-include-dirs @ONLY) ${CMAKE_BINARY_DIR}/hilti-cxx-include-dirs @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/zeek-version.h.in configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake_templates/zeek-version.h.in
${CMAKE_CURRENT_BINARY_DIR}/zeek-version.h) ${CMAKE_CURRENT_BINARY_DIR}/zeek-version.h)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/zeek-version.h DESTINATION include/zeek) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/zeek-version.h DESTINATION include/zeek)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/zeek-config.h.in configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake_templates/zeek-config.h.in
${CMAKE_CURRENT_BINARY_DIR}/zeek-config.h) ${CMAKE_CURRENT_BINARY_DIR}/zeek-config.h)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/zeek-config.h DESTINATION include/zeek) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/zeek-config.h DESTINATION include/zeek)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/zeek-config-paths.h.in configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake_templates/zeek-config-paths.h.in
${CMAKE_CURRENT_BINARY_DIR}/zeek-config-paths.h) ${CMAKE_CURRENT_BINARY_DIR}/zeek-config-paths.h)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/zeek-config-paths.h DESTINATION include/zeek) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/zeek-config-paths.h DESTINATION include/zeek)

View file

@ -170,7 +170,7 @@ def main():
zeek_dir = pathlib.Path(args.dir).absolute() zeek_dir = pathlib.Path(args.dir).absolute()
if not (zeek_dir / "zeek-config.h.in").exists(): if not (zeek_dir / "cmake_templates" / "zeek-config.h.in").exists():
logger.error("%s missing zeek-config.h.in", zeek_dir) logger.error("%s missing zeek-config.h.in", zeek_dir)
return 1 return 1

View file

@ -0,0 +1,14 @@
#!/bin/sh
# After configured by CMake, this file prints the absolute path to Zeek scripts
# that come with the source distributions of Zeek as well as scripts that are
# generated by the BIF compiler at compile time.
#
# The intended use of this script is to make it easier to run Zeek from
# the build directory, avoiding the need to install it. This could be
# done like:
#
# ZEEKPATH=`./zeek-path-dev` ./src/zeek
#
# This file should be kept in sync with the ZEEKPATH line in zeek-path-dev.bat.in.
echo .:${cmake_source_dir}/scripts:${cmake_source_dir}/scripts/policy:${cmake_source_dir}/scripts/site:${cmake_binary_dir}/scripts:${cmake_binary_dir}/scripts/builtin-plugins

View file

@ -1,14 +0,0 @@
#!/bin/sh
# After configured by CMake, this file prints the absolute path to Zeek scripts
# that come with the source distributions of Zeek as well as scripts that are
# generated by the BIF compiler at compile time.
#
# The intended use of this script is to make it easier to run Zeek from
# the build directory, avoiding the need to install it. This could be
# done like:
#
# ZEEKPATH=`./zeek-path-dev` ./src/zeek
#
# This file should be kept in sync with the ZEEKPATH line in zeek-path-dev.bat.in.
echo .:${cmake_source_dir}/scripts:${cmake_source_dir}/scripts/policy:${cmake_source_dir}/scripts/site:${cmake_binary_dir}/scripts:${cmake_binary_dir}/scripts/builtin-plugins

1
zeek-path-dev.in Symbolic link
View file

@ -0,0 +1 @@
cmake_templates/zeek-path-dev.in