This is an automated email from the ASF dual-hosted git repository.

wasphin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brpc.git


The following commit(s) were added to refs/heads/master by this push:
     new a72f2d6d Fix CMake zlib dependency discovery
a72f2d6d is described below

commit a72f2d6db1e9cb66e9f89e7c25e7823d02d11c6a
Author: Chuang Zhang <[email protected]>
AuthorDate: Tue Aug 25 23:55:22 2026 +0800

    Fix CMake zlib dependency discovery
    
    Discover zlib explicitly with find_package(ZLIB REQUIRED) and link against 
the ZLIB::ZLIB imported target instead of the bare z library. This allows CMake 
to use the zlib configuration selected by the active toolchain.
---
 CMakeLists.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9419ac3a..93113b6f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -227,6 +227,7 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
 endif()
 
 find_package(Protobuf REQUIRED)
+find_package(ZLIB REQUIRED)
 if(Protobuf_VERSION VERSION_GREATER 4.21)
     # required by absl
     set(BRPC_CXX_STANDARD 17)
@@ -351,7 +352,7 @@ set(DYNAMIC_LIB
     ${CMAKE_THREAD_LIBS_INIT}
     ${THRIFT_LIB}
     dl
-    z)
+    ZLIB::ZLIB)
 
 if(WITH_BORINGSSL)
     list(APPEND DYNAMIC_LIB ${BORINGSSL_SSL_LIBRARY})


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to