about summary refs log tree commit diff
path: root/cmake/CompileProtos.cmake
diff options
context:
space:
mode:
authorCarlos O'Ryan <coryan@google.com>2019-07-01T18·39-0400
committerCarlos O'Ryan <coryan@google.com>2019-07-01T18·39-0400
commit620940a411b3723e1641dc253e5a15d27852f515 (patch)
tree91915b66a282dc47509682756d600a1e0430fb41 /cmake/CompileProtos.cmake
parenteab5cb57dd38531023b1e7e7a529882c268d1333 (diff)
Fix installation path for protos.
Diffstat (limited to 'cmake/CompileProtos.cmake')
-rw-r--r--cmake/CompileProtos.cmake16
1 files changed, 8 insertions, 8 deletions
diff --git a/cmake/CompileProtos.cmake b/cmake/CompileProtos.cmake
index a01a90b825e8..c4bd8982b907 100644
--- a/cmake/CompileProtos.cmake
+++ b/cmake/CompileProtos.cmake
@@ -221,22 +221,22 @@ function (google_cloud_cpp_install_proto_library_headers target)
 endfunction ()
 
 # Install protos for a C++ proto library.
-function (google_cloud_cpp_install_proto_library_protos target)
+function (google_cloud_cpp_install_proto_library_protos target strip_prefix)
     get_target_property(target_protos ${target} PROTO_SOURCES)
-    foreach (header ${target_protos})
+    foreach (proto ${target_protos})
         # Skip anything that is not a header file.
-        if (NOT "${header}" MATCHES "\\.proto$")
+        if (NOT "${proto}" MATCHES "\\.proto$")
             continue()
         endif ()
-        string(REPLACE "${CMAKE_CURRENT_BINARY_DIR}/"
-                       ""
-                       relative
-                       "${header}")
+	string(REPLACE "${strip_prefix}/"
+		       ""
+		       relative
+		       "${proto}")
         get_filename_component(dir "${relative}" DIRECTORY)
         # This is modeled after the Protobuf library, it installs the basic
         # protos (think google/protobuf/any.proto) in the include directory for
         # C/C++ code. :shrug:
-        install(FILES "${header}" DESTINATION
+        install(FILES "${proto}" DESTINATION
                       "${CMAKE_INSTALL_INCLUDEDIR}/${dir}")
     endforeach ()
 endfunction ()