diff --git a/CMakeLists.txt b/CMakeLists.txt index 126d1fa95cf..f4d4aed9618 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26257,10 +26257,12 @@ if(gRPC_INSTALL) DESTINATION ${gRPC_INSTALL_CMAKEDIR} NAMESPACE gRPC:: ) - install(EXPORT gRPCPluginTargets - DESTINATION ${gRPC_INSTALL_CMAKEDIR} - NAMESPACE gRPC:: - ) + if(gRPC_BUILD_CODEGEN) + install(EXPORT gRPCPluginTargets + DESTINATION ${gRPC_INSTALL_CMAKEDIR} + NAMESPACE gRPC:: + ) + endif() endif() include(CMakePackageConfigHelpers) diff --git a/templates/CMakeLists.txt.template b/templates/CMakeLists.txt.template index 7be9b0a2ae2..2b340efd4c2 100644 --- a/templates/CMakeLists.txt.template +++ b/templates/CMakeLists.txt.template @@ -812,10 +812,12 @@ DESTINATION <%text>${gRPC_INSTALL_CMAKEDIR} NAMESPACE gRPC:: ) - install(EXPORT gRPCPluginTargets - DESTINATION <%text>${gRPC_INSTALL_CMAKEDIR} - NAMESPACE gRPC:: - ) + if(gRPC_BUILD_CODEGEN) + install(EXPORT gRPCPluginTargets + DESTINATION <%text>${gRPC_INSTALL_CMAKEDIR} + NAMESPACE gRPC:: + ) + endif() endif() include(CMakePackageConfigHelpers)