From 586f719898486303c0c990919bfba05a3e127a16 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 16 Jan 2018 17:57:17 +0100 Subject: cleanup cmake include directories --- cmake/zlib.cmake | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'cmake/zlib.cmake') 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() -- cgit v1.2.3