diff options
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | cmake/CompileProtos.cmake | 16 |
2 files changed, 9 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index edc8f2320562..d9894ff28802 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -267,7 +267,7 @@ install(TARGETS ${googleapis_cpp_installed_libraries_list} foreach (target ${googleapis_cpp_installed_libraries_list}) google_cloud_cpp_install_proto_library_headers("${target}") - google_cloud_cpp_install_proto_library_protos("${target}") + google_cloud_cpp_install_proto_library_protos("${target}" "${GOOGLEAPIS_CPP_SOURCE}") endforeach () # Export the CMake targets to make it easy to create configuration files. 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 () |