diff options
| author | Max Smolens <max.smolens@kitware.com> | 2017-02-07 15:30:19 -0500 |
|---|---|---|
| committer | Max Smolens <max.smolens@kitware.com> | 2017-02-07 15:43:52 -0500 |
| commit | 8c322ca613a51798741812dc4d0125dc9324b448 (patch) | |
| tree | f0e0adb8f2a43bc932c4f37bbaac6e403886a789 | |
| parent | 63e33061e13518701d05bacb811753556c2bc058 (diff) | |
| download | vcpkg-8c322ca613a51798741812dc4d0125dc9324b448.tar.gz vcpkg-8c322ca613a51798741812dc4d0125dc9324b448.zip | |
[grpc] Fix exported targets
Fix gRPC's exported targets. Now CMake projects can do:
find_package(gRPC CONFIG REQUIRED)
and then use the exported targets such as gRPC::grpc and gRPC::grpc++.
Additionally, install gRPC tools and protoc plugins into the 'tools'
directory. The plugins are required to generate gRPC client and server
interfaces from .proto service definitions.
| -rw-r--r-- | ports/grpc/portfile.cmake | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/ports/grpc/portfile.cmake b/ports/grpc/portfile.cmake index ffd71d137..9c4ddbc06 100644 --- a/ports/grpc/portfile.cmake +++ b/ports/grpc/portfile.cmake @@ -48,12 +48,33 @@ vcpkg_install_cmake() file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/share/grpc) file(RENAME ${CURRENT_PACKAGES_DIR}/lib/cmake/gRPC/gRPCConfig.cmake ${CURRENT_PACKAGES_DIR}/share/grpc/gRPCConfig.cmake) file(RENAME ${CURRENT_PACKAGES_DIR}/lib/cmake/gRPC/gRPCConfigVersion.cmake ${CURRENT_PACKAGES_DIR}/share/grpc/gRPCConfigVersion.cmake) -file(RENAME ${CURRENT_PACKAGES_DIR}/lib/cmake/gRPC/gRPCTargets.cmake ${CURRENT_PACKAGES_DIR}/share/grpc/gRPCTargets.cmake) -file(RENAME ${CURRENT_PACKAGES_DIR}/lib/cmake/gRPC/gRPCTargets-release.cmake ${CURRENT_PACKAGES_DIR}/share/grpc/gRPCTargets-release.cmake) -file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/cmake/gRPC/gRPCTargets-debug.cmake ${CURRENT_PACKAGES_DIR}/share/grpc/gRPCTargets-debug.cmake) + +# Update import target prefix in gRPCTargets.cmake +file(READ ${CURRENT_PACKAGES_DIR}/lib/cmake/gRPC/gRPCTargets.cmake _contents) +set(pattern "get_filename_component(_IMPORT_PREFIX \"\${_IMPORT_PREFIX}\" PATH)\n") +string(REPLACE "${pattern}${pattern}" "${pattern}" _contents "${_contents}") +file(WRITE ${CURRENT_PACKAGES_DIR}/share/grpc/gRPCTargets.cmake "${_contents}") + +# Update paths in gRPCTargets-release.cmake +file(READ ${CURRENT_PACKAGES_DIR}/lib/cmake/gRPC/gRPCTargets-release.cmake _contents) +string(REPLACE "\${_IMPORT_PREFIX}/bin/" "\${_IMPORT_PREFIX}/tools/" _contents "${_contents}") +file(WRITE ${CURRENT_PACKAGES_DIR}/share/grpc/gRPCTargets-release.cmake "${_contents}") + +# Update paths in gRPCTargets-debug.cmake +file(READ ${CURRENT_PACKAGES_DIR}/debug/lib/cmake/gRPC/gRPCTargets-debug.cmake _contents) +string(REPLACE "\${_IMPORT_PREFIX}/bin/" "\${_IMPORT_PREFIX}/tools/" _contents "${_contents}") +string(REPLACE "\${_IMPORT_PREFIX}/lib/" "\${_IMPORT_PREFIX}/debug/lib/" _contents "${_contents}") +file(WRITE ${CURRENT_PACKAGES_DIR}/share/grpc/gRPCTargets-debug.cmake "${_contents}") file(INSTALL ${CURRENT_BUILDTREES_DIR}/src/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/grpc RENAME copyright) +# Install tools and plugins +file( + INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/Release/ + DESTINATION ${CURRENT_PACKAGES_DIR}/tools + FILES_MATCHING PATTERN "*.exe" +) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin) |
