aboutsummaryrefslogtreecommitdiff
path: root/scripts/cmake/vcpkg_escape_regex_control_characters.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/cmake/vcpkg_escape_regex_control_characters.cmake')
-rw-r--r--scripts/cmake/vcpkg_escape_regex_control_characters.cmake4
1 files changed, 4 insertions, 0 deletions
diff --git a/scripts/cmake/vcpkg_escape_regex_control_characters.cmake b/scripts/cmake/vcpkg_escape_regex_control_characters.cmake
new file mode 100644
index 000000000..3d9d92b5e
--- /dev/null
+++ b/scripts/cmake/vcpkg_escape_regex_control_characters.cmake
@@ -0,0 +1,4 @@
+function(vcpkg_escape_regex_control_characters out_var string_with_regex_characters)
+ string(REGEX REPLACE "[][+.*()^\\$?|]" "\\\\\\0" _escaped_content "${string_with_regex_characters}")
+ set(${out_var} "${_escaped_content}" PARENT_SCOPE)
+endfunction()