aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhangskz <sandyzhang@google.com>2023-11-29 23:41:22 -0800
committerGitHub <noreply@github.com>2023-11-29 23:41:22 -0800
commit59eebe3e76ca77682437125839f504109a44ab36 (patch)
tree0f8a700a006c9cbb46586ff64524ce82235f366f
parentc709a34fbdf90f3fca092967dc90bdf7c6597ba4 (diff)
parent05ad6525c3aae2ae5b6e1987227445a420caada7 (diff)
downloadprotobuf-59eebe3e76ca77682437125839f504109a44ab36.tar.gz
Merge pull request #14907 from mkruskal-google/cmake-install-fix
Only substitute prefixes during installation setup.
-rw-r--r--cmake/install.cmake5
1 files changed, 4 insertions, 1 deletions
diff --git a/cmake/install.cmake b/cmake/install.cmake
index 998c2e31a..9679d5b26 100644
--- a/cmake/install.cmake
+++ b/cmake/install.cmake
@@ -78,7 +78,10 @@ foreach(_header ${protobuf_HEADERS})
elseif (_find_nosrc GREATER -1)
set(_from_dir "${protobuf_SOURCE_DIR}")
endif()
- string(REPLACE "${_from_dir}" "" _header ${_header})
+ # 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.
+ string(REGEX REPLACE "^${_from_dir}" "" _header ${_header})
get_filename_component(_extract_from "${_from_dir}/${_header}" ABSOLUTE)
get_filename_component(_extract_name ${_header} NAME)
get_filename_component(_extract_to "${CMAKE_INSTALL_INCLUDEDIR}/${_header}" DIRECTORY)