aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSandy Zhang <sandyzhang@google.com>2024-02-12 11:12:08 -0800
committerSandy Zhang <sandyzhang@google.com>2024-02-14 14:56:15 -0500
commit3ad69cf8b07ebcd54e76ee5360586a41b4f9d627 (patch)
treecda1aeb74cd049ef41ef558abe5ed6acef6312c2
parentf740f528fa08f9d126650d92472a921e53a95a73 (diff)
downloadprotobuf-3ad69cf8b07ebcd54e76ee5360586a41b4f9d627.tar.gz
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
-rw-r--r--cmake/install.cmake2
1 files changed, 1 insertions, 1 deletions
diff --git a/cmake/install.cmake b/cmake/install.cmake
index 18ebb37b6..52914a8ea 100644
--- a/cmake/install.cmake
+++ b/cmake/install.cmake
@@ -79,7 +79,7 @@ foreach(_header ${protobuf_HEADERS})
set(_from_dir "${protobuf_SOURCE_DIR}")
endif()
# Escape _from_dir for regex special characters in the directory name.
- string(REGEX REPLACE "([.+*?\^$()[\]{}|\\])" "\\\\$1" _from_dir_regexp ${_from_dir})
+ string(REGEX REPLACE "([$^.[|*+?()]|])" "\\\\\\1" _from_dir_regexp "${_from_dir}")
# On some platforms `_form_dir` ends up being just "protobuf", which can
# easily match multiple times in our paths. We force it to only replace
# prefixes to avoid this case.