From b70df57c498a5757693266612bc51e45f2713ab3 Mon Sep 17 00:00:00 2001
From: Jan Tattermusch <jtattermusch@google.com>
Date: Mon, 19 Jun 2017 16:37:15 +0200
Subject: [PATCH] build protobuf without zlib

---
 CMakeLists.txt                    | 5 +++++
 templates/CMakeLists.txt.template | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index e8094b7255..f5e863183b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -162,6 +162,11 @@ if("${gRPC_PROTOBUF_PROVIDER}" STREQUAL "module")
   if(NOT protobuf_BUILD_TESTS)
     set(protobuf_BUILD_TESTS OFF CACHE BOOL "Build protobuf tests")
   endif()
+  # Disable building protobuf with zlib. Building protobuf with zlib breaks
+  # the build if zlib is not installed on the system.
+  if(NOT protobuf_WITH_ZLIB)
+    set(protobuf_WITH_ZLIB OFF CACHE BOOL "Build protobuf with zlib.")
+  endif()
   if(NOT PROTOBUF_ROOT_DIR)
     set(PROTOBUF_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/protobuf)
   endif()
diff --git a/templates/CMakeLists.txt.template b/templates/CMakeLists.txt.template
index 91bed9a6db..d279d02553 100644
--- a/templates/CMakeLists.txt.template
+++ b/templates/CMakeLists.txt.template
@@ -207,6 +207,11 @@
     if(NOT protobuf_BUILD_TESTS)
       set(protobuf_BUILD_TESTS OFF CACHE BOOL "Build protobuf tests")
     endif()
+    # Disable building protobuf with zlib. Building protobuf with zlib breaks
+    # the build if zlib is not installed on the system.
+    if(NOT protobuf_WITH_ZLIB)
+      set(protobuf_WITH_ZLIB OFF CACHE BOOL "Build protobuf with zlib.")
+    endif()
     if(NOT PROTOBUF_ROOT_DIR)
       set(PROTOBUF_ROOT_DIR <%text>${CMAKE_CURRENT_SOURCE_DIR}</%text>/third_party/protobuf)
     endif()
-- 
GitLab