diff --git a/CMakeLists.txt b/CMakeLists.txt index a65ce567a6ce068646381c40b99043b172ed0d2c..c4e0e0162d5ecf51d6b2163ae51fe2024a326704 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14326,6 +14326,13 @@ endif (gRPC_BUILD_TESTS) +if (gRPC_INSTALL) + install(EXPORT gRPCTargets + DESTINATION ${CMAKE_INSTALL_CMAKEDIR} + NAMESPACE gRPC:: + ) +endif() + foreach(_config gRPCConfig gRPCConfigVersion) configure_file(tools/cmake/${_config}.cmake.in ${_config}.cmake @ONLY) diff --git a/templates/CMakeLists.txt.template b/templates/CMakeLists.txt.template index 3e03afdf579ca48e4d53c828d4a62961c861928f..acf39305fadf9b351aece2137ebdd7b370053039 100644 --- a/templates/CMakeLists.txt.template +++ b/templates/CMakeLists.txt.template @@ -618,6 +618,13 @@ endif() </%def> + if (gRPC_INSTALL) + install(EXPORT gRPCTargets + DESTINATION <%text>${CMAKE_INSTALL_CMAKEDIR}</%text> + NAMESPACE gRPC:: + ) + endif() + foreach(_config gRPCConfig gRPCConfigVersion) configure_file(tools/cmake/<%text>${_config}</%text>.cmake.in <%text>${_config}</%text>.cmake @ONLY)