Skip to content

Commit 3ad69cf

Browse files
committed
Fix CMake regex escaping.
CMake documentation (https://cmake.org/cmake/help/latest/command/string.html#regex-replace) indicates subexpressions are actually referenced via \1 not $1 in cmake. PiperOrigin-RevId: 606307156
1 parent f740f52 commit 3ad69cf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cmake/install.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ foreach(_header ${protobuf_HEADERS})
7979
set(_from_dir "${protobuf_SOURCE_DIR}")
8080
endif()
8181
# Escape _from_dir for regex special characters in the directory name.
82-
string(REGEX REPLACE "([.+*?\^$()[\]{}|\\])" "\\\\$1" _from_dir_regexp ${_from_dir})
82+
string(REGEX REPLACE "([$^.[|*+?()]|])" "\\\\\\1" _from_dir_regexp "${_from_dir}")
8383
# On some platforms `_form_dir` ends up being just "protobuf", which can
8484
# easily match multiple times in our paths. We force it to only replace
8585
# prefixes to avoid this case.

0 commit comments

Comments
 (0)