Author: brane
Date: Thu Jan  1 11:28:58 2026
New Revision: 1931031

Log:
In the CMake build: In some cases, using a target instead of a library
path makes a configure check fail. Make sure to use the right path to the
Brotli decoder library with both pkg-config and find_package().

* CMakeLists.txt: Tell pkg-config to look for "Brotly_Decode" and then,
   similarly to the OpenSSL case, set variables that are compatible
   with the results of the FindBrotli.cmake script. Use the library
   path instead of the imported target in CheckFunciton().

Modified:
   serf/trunk/CMakeLists.txt

Modified: serf/trunk/CMakeLists.txt
==============================================================================
--- serf/trunk/CMakeLists.txt   Thu Jan  1 10:39:04 2026        (r1931030)
+++ serf/trunk/CMakeLists.txt   Thu Jan  1 11:28:58 2026        (r1931031)
@@ -280,12 +280,16 @@ list(APPEND SERF_C_DEFINES "OPENSSL_NO_S
 
 # Find optional dependencies
 if(USE_BROTLI)
-  SerfFindPkgConfig(Brotli Brotli_ROOT libbrotlidec Brotli::Decode)
-  if(NOT Brotli_FOUND)
+  SerfFindPkgConfig(Brotli_Decode Brotli_ROOT libbrotlidec Brotli::Decode)
+  if(NOT Brotli_Decode_FOUND)
     find_package(Brotli)
     if(Brotli_FOUND)
       set(BROTLI_PC_LIBS ${BROTLI_DECODE_LIBRARY})
     endif()
+  else()
+    set(Brotli_FOUND TRUE)
+    set(BROTLI_INCLUDE_DIR ${BROTLI_DECODE_INCLUDE_DIR})
+    set(BROTLI_PC_REQUIRES ${BROTLI_DECODE_PC_REQUIRES})
   endif()
 endif()
 
@@ -396,7 +400,7 @@ if(Brotli_FOUND)
   if("SERF_HAVE_BROTLI_DECODER_RESULT" IN_LIST SERF_C_DEFINES)
     CheckFunction("BrotliDecoderTakeOutput" "NULL, NULL" "SERF_HAVE_BROTLI"
                   "brotli/decode.h" ${BROTLI_INCLUDE_DIR}
-                  Brotli::Decode ${SERF_STANDARD_LIBRARIES})
+                  ${BROTLI_DECODE_LIBRARY} ${SERF_STANDARD_LIBRARIES})
   endif()
 endif()
 

Reply via email to