aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmake/zlib.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/zlib.cmake')
-rw-r--r--cmake/zlib.cmake8
1 files changed, 7 insertions, 1 deletions
diff --git a/cmake/zlib.cmake b/cmake/zlib.cmake
index 16cd9e66d5..e324802f65 100644
--- a/cmake/zlib.cmake
+++ b/cmake/zlib.cmake
@@ -34,6 +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_FIND_ZLIB "if(NOT ZLIB_FOUND)\n find_package(ZLIB)\nendif()")
endif()