From 74c74fb04e98fa3641a0eaddddb5526a921f3520 Mon Sep 17 00:00:00 2001
From: Jan Tattermusch <jtattermusch@google.com>
Date: Mon, 19 Jun 2017 16:14:50 +0200
Subject: [PATCH] workaround zlib cmake issue

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

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 852eb2bf6c..e8094b7255 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -98,6 +98,9 @@ if("${gRPC_ZLIB_PROVIDER}" STREQUAL "module")
   endif()
   set(ZLIB_INCLUDE_DIR "${ZLIB_ROOT_DIR}")
   if(EXISTS "${ZLIB_ROOT_DIR}/CMakeLists.txt")
+      # TODO(jtattermusch): workaround for https://github.com/madler/zlib/issues/218
+      include_directories(${ZLIB_INCLUDE_DIR})
+
       add_subdirectory(${ZLIB_ROOT_DIR} third_party/zlib)
       if(TARGET zlibstatic)
           set(_gRPC_ZLIB_LIBRARIES zlibstatic)
diff --git a/templates/CMakeLists.txt.template b/templates/CMakeLists.txt.template
index ef0faccb2e..91bed9a6db 100644
--- a/templates/CMakeLists.txt.template
+++ b/templates/CMakeLists.txt.template
@@ -143,6 +143,9 @@
     endif()
     set(ZLIB_INCLUDE_DIR "<%text>${ZLIB_ROOT_DIR}</%text>")
     if(EXISTS "<%text>${ZLIB_ROOT_DIR}</%text>/CMakeLists.txt")
+        # TODO(jtattermusch): workaround for https://github.com/madler/zlib/issues/218
+        include_directories(<%text>${ZLIB_INCLUDE_DIR}</%text>)
+
         add_subdirectory(<%text>${ZLIB_ROOT_DIR}</%text> third_party/zlib)
         if(TARGET zlibstatic)
             set(_gRPC_ZLIB_LIBRARIES zlibstatic)
-- 
GitLab