aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmake/zlib.cmake
diff options
context:
space:
mode:
authorGravatar Jan Tattermusch <jtattermusch@google.com>2018-01-16 17:57:17 +0100
committerGravatar Jan Tattermusch <jtattermusch@google.com>2018-01-16 18:07:46 +0100
commit586f719898486303c0c990919bfba05a3e127a16 (patch)
treeb6238ad39200b74f20c70eba3987027d53348893 /cmake/zlib.cmake
parenta41e997a8785243ee3c1e91c5dcfb73d698ac48d (diff)
cleanup cmake include directories
Diffstat (limited to 'cmake/zlib.cmake')
-rw-r--r--cmake/zlib.cmake15
1 files changed, 8 insertions, 7 deletions
diff --git a/cmake/zlib.cmake b/cmake/zlib.cmake
index 16cd9e66d5..4a9d2f011b 100644
--- a/cmake/zlib.cmake
+++ b/cmake/zlib.cmake
@@ -16,15 +16,15 @@ if("${gRPC_ZLIB_PROVIDER}" STREQUAL "module")
if(NOT ZLIB_ROOT_DIR)
set(ZLIB_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/zlib)
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})
+ # TODO(jtattermusch): workaround for https://github.com/madler/zlib/issues/218
+ include_directories("${ZLIB_ROOT_DIR}")
+ add_subdirectory(${ZLIB_ROOT_DIR} third_party/zlib)
- add_subdirectory(${ZLIB_ROOT_DIR} third_party/zlib)
- if(TARGET zlibstatic)
- set(_gRPC_ZLIB_LIBRARIES zlibstatic)
- endif()
+ if(TARGET zlibstatic)
+ set(_gRPC_ZLIB_LIBRARIES zlibstatic)
+ set(_gRPC_ZLIB_INCLUDE_DIR "${ZLIB_ROOT_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib")
+ endif()
else()
message(WARNING "gRPC_ZLIB_PROVIDER is \"module\" but ZLIB_ROOT_DIR is wrong")
endif()
@@ -35,5 +35,6 @@ if("${gRPC_ZLIB_PROVIDER}" STREQUAL "module")
elseif("${gRPC_ZLIB_PROVIDER}" STREQUAL "package")
find_package(ZLIB REQUIRED)
set(_gRPC_ZLIB_LIBRARIES ${ZLIB_LIBRARIES})
+ set(_gRPC_ZLIB_INCLUDE_DIR ${ZLIB_INCLUDE_DIRS})
set(_gRPC_FIND_ZLIB "if(NOT ZLIB_FOUND)\n find_package(ZLIB)\nendif()")
endif()