Escape special characters in paths before using them as regexes

This commit is contained in:
Tim Wojtulewicz 2022-04-14 12:38:14 -07:00
parent 37df5a30b1
commit f8de297c6f
2 changed files with 6 additions and 2 deletions

2
cmake

@ -1 +1 @@
Subproject commit 960ca0a43b1691b771245826a50fcf53d49ed59b
Subproject commit d23b14b4c146d59ebb68b81650e2e314047ed460

View file

@ -575,6 +575,10 @@ install(CODE "
)
")
# Make sure to escape a bunch of special characters in the path before trying to use it as a
# regular expression below.
string(REGEX REPLACE "([][+.*()^])" "\\\\\\1" escaped_path "${CMAKE_CURRENT_SOURCE_DIR}/zeek")
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/
DESTINATION include/zeek
FILES_MATCHING
@ -582,7 +586,7 @@ install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/
PATTERN "*.pac"
PATTERN "3rdparty/*" EXCLUDE
# The "zeek -> ." symlink isn't needed in the install-tree
REGEX "^${CMAKE_CURRENT_SOURCE_DIR}/zeek$" EXCLUDE
REGEX "^${escaped_path}$" EXCLUDE
)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/