Fix installation path for protos.

This commit is contained in:
Carlos O'Ryan 2019-07-01 14:39:09 -04:00
parent eab5cb57dd
commit 620940a411
No known key found for this signature in database
GPG key ID: BC4C1DC8B0DEF583
2 changed files with 9 additions and 9 deletions

View file

@ -267,7 +267,7 @@ install(TARGETS ${googleapis_cpp_installed_libraries_list}
foreach (target ${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_headers("${target}")
google_cloud_cpp_install_proto_library_protos("${target}") google_cloud_cpp_install_proto_library_protos("${target}" "${GOOGLEAPIS_CPP_SOURCE}")
endforeach () endforeach ()
# Export the CMake targets to make it easy to create configuration files. # Export the CMake targets to make it easy to create configuration files.

View file

@ -221,22 +221,22 @@ function (google_cloud_cpp_install_proto_library_headers target)
endfunction () endfunction ()
# Install protos for a C++ proto library. # 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) get_target_property(target_protos ${target} PROTO_SOURCES)
foreach (header ${target_protos}) foreach (proto ${target_protos})
# Skip anything that is not a header file. # Skip anything that is not a header file.
if (NOT "${header}" MATCHES "\\.proto$") if (NOT "${proto}" MATCHES "\\.proto$")
continue() continue()
endif () endif ()
string(REPLACE "${CMAKE_CURRENT_BINARY_DIR}/" string(REPLACE "${strip_prefix}/"
"" ""
relative relative
"${header}") "${proto}")
get_filename_component(dir "${relative}" DIRECTORY) get_filename_component(dir "${relative}" DIRECTORY)
# This is modeled after the Protobuf library, it installs the basic # This is modeled after the Protobuf library, it installs the basic
# protos (think google/protobuf/any.proto) in the include directory for # protos (think google/protobuf/any.proto) in the include directory for
# C/C++ code. :shrug: # C/C++ code. :shrug:
install(FILES "${header}" DESTINATION install(FILES "${proto}" DESTINATION
"${CMAKE_INSTALL_INCLUDEDIR}/${dir}") "${CMAKE_INSTALL_INCLUDEDIR}/${dir}")
endforeach () endforeach ()
endfunction () endfunction ()