From 08a039446f8df090724c8ae54bbe932d36a8a2e8 Mon Sep 17 00:00:00 2001 From: Tim Wojtulewicz Date: Tue, 25 Apr 2023 14:47:07 -0700 Subject: [PATCH] Add template file and cmake call for zeek-path setup on Windows --- CMakeLists.txt | 4 ++++ zeek-path-dev.bat.in | 8 ++++++++ zeek-path-dev.in | 1 + 3 files changed, 13 insertions(+) create mode 100644 zeek-path-dev.bat.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 992aaca2b4..03eab558b8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -423,6 +423,10 @@ set(cmake_install_prefix "${CMAKE_INSTALL_PREFIX}") set(cmake_source_dir "${CMAKE_SOURCE_DIR}") set(zeek_script_install_path "${ZEEK_SCRIPT_INSTALL_PATH}") if ( MSVC ) + # This has to happen before we modify the paths below so that + # the pure Windows paths are stored in the output file. + configure_file(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_current_binary_dir "${cmake_current_binary_dir}") string(REGEX REPLACE "^([A-Za-z]):/(.*)" "/\\1/\\2" cmake_install_prefix "${cmake_install_prefix}") diff --git a/zeek-path-dev.bat.in b/zeek-path-dev.bat.in new file mode 100644 index 0000000000..342b770492 --- /dev/null +++ b/zeek-path-dev.bat.in @@ -0,0 +1,8 @@ +:: Sets up the basic environment needed to run Zeek from a Windows command prompt (not bash!). +:: This is needed in order to run unit tests on Cirrus. +:: +:: The ZEEKPATH line here should be kept in sync with the zeek-path-dev.in file. +:: + +set ZEEKPATH=.;${cmake_source_dir}/scripts;${cmake_source_dir}/scripts/policy;${cmake_source_dir}/scripts/site;${cmake_binary_dir}/scripts;${cmake_binary_dir}/scripts/builtin-plugins +set ZEEK_PLUGIN_PATH=${cmake_binary_dir}/src} diff --git a/zeek-path-dev.in b/zeek-path-dev.in index 0c5fa4fbd2..e80b2222d2 100755 --- a/zeek-path-dev.in +++ b/zeek-path-dev.in @@ -9,5 +9,6 @@ # # 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