Skip to content

Commit b63c1bb

Browse files
committed
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(). git-svn-id: https://svn.apache.org/repos/asf/serf/trunk@1931031 13f79535-47bb-0310-9956-ffa450edef68
1 parent c542a6e commit b63c1bb

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

CMakeLists.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,12 +280,16 @@ list(APPEND SERF_C_DEFINES "OPENSSL_NO_STDIO")
280280

281281
# Find optional dependencies
282282
if(USE_BROTLI)
283-
SerfFindPkgConfig(Brotli Brotli_ROOT libbrotlidec Brotli::Decode)
284-
if(NOT Brotli_FOUND)
283+
SerfFindPkgConfig(Brotli_Decode Brotli_ROOT libbrotlidec Brotli::Decode)
284+
if(NOT Brotli_Decode_FOUND)
285285
find_package(Brotli)
286286
if(Brotli_FOUND)
287287
set(BROTLI_PC_LIBS ${BROTLI_DECODE_LIBRARY})
288288
endif()
289+
else()
290+
set(Brotli_FOUND TRUE)
291+
set(BROTLI_INCLUDE_DIR ${BROTLI_DECODE_INCLUDE_DIR})
292+
set(BROTLI_PC_REQUIRES ${BROTLI_DECODE_PC_REQUIRES})
289293
endif()
290294
endif()
291295

@@ -396,7 +400,7 @@ if(Brotli_FOUND)
396400
if("SERF_HAVE_BROTLI_DECODER_RESULT" IN_LIST SERF_C_DEFINES)
397401
CheckFunction("BrotliDecoderTakeOutput" "NULL, NULL" "SERF_HAVE_BROTLI"
398402
"brotli/decode.h" ${BROTLI_INCLUDE_DIR}
399-
Brotli::Decode ${SERF_STANDARD_LIBRARIES})
403+
${BROTLI_DECODE_LIBRARY} ${SERF_STANDARD_LIBRARIES})
400404
endif()
401405
endif()
402406

0 commit comments

Comments
 (0)