aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmake/zlib.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/zlib.cmake')
-rw-r--r--cmake/zlib.cmake7
1 files changed, 6 insertions, 1 deletions
diff --git a/cmake/zlib.cmake b/cmake/zlib.cmake
index 4a9d2f011b..e4c94f5213 100644
--- a/cmake/zlib.cmake
+++ b/cmake/zlib.cmake
@@ -34,7 +34,12 @@ if("${gRPC_ZLIB_PROVIDER}" STREQUAL "module")
endif()
elseif("${gRPC_ZLIB_PROVIDER}" STREQUAL "package")
find_package(ZLIB REQUIRED)
- set(_gRPC_ZLIB_LIBRARIES ${ZLIB_LIBRARIES})
+
+ if(TARGET ZLIB::ZLIB)
+ set(_gRPC_ZLIB_LIBRARIES ZLIB::ZLIB)
+ else()
+ set(_gRPC_ZLIB_LIBRARIES ${ZLIB_LIBRARIES})
+ endif()
set(_gRPC_ZLIB_INCLUDE_DIR ${ZLIB_INCLUDE_DIRS})
set(_gRPC_FIND_ZLIB "if(NOT ZLIB_FOUND)\n find_package(ZLIB)\nendif()")
endif()