File tree 1 file changed +3
-1
lines changed
1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -78,10 +78,12 @@ foreach(_header ${protobuf_HEADERS})
78
78
elseif (_find_nosrc GREATER -1)
79
79
set (_from_dir "${protobuf_SOURCE_DIR} " )
80
80
endif ()
81
+ # Escape _from_dir for regex special characters in the directory name.
82
+ string (REGEX REPLACE "([.+*?\^ $()[\] {}|\\ ])" "\\\\ $1" _from_dir_regexp ${_from_dir} )
81
83
# On some platforms `_form_dir` ends up being just "protobuf", which can
82
84
# easily match multiple times in our paths. We force it to only replace
83
85
# prefixes to avoid this case.
84
- string (REGEX REPLACE "^${_from_dir } " "" _header ${_header} )
86
+ string (REGEX REPLACE "^${_from_dir_regexp } " "" _header ${_header} )
85
87
get_filename_component (_extract_from "${_from_dir} /${_header} " ABSOLUTE )
86
88
get_filename_component (_extract_name ${_header} NAME )
87
89
get_filename_component (_extract_to "${CMAKE_INSTALL_INCLUDEDIR} /${_header} " DIRECTORY )
You can’t perform that action at this time.
0 commit comments