cmake: add code to detect system brotli library (#952)
This commit is contained in:
Родитель
19d2ebb6f6
Коммит
f3824aa8d0
|
@ -3,8 +3,17 @@ function(cpprest_find_brotli)
|
|||
return()
|
||||
endif()
|
||||
|
||||
find_package(unofficial-brotli REQUIRED)
|
||||
|
||||
add_library(cpprestsdk_brotli_internal INTERFACE)
|
||||
target_link_libraries(cpprestsdk_brotli_internal INTERFACE unofficial::brotli::brotlienc unofficial::brotli::brotlidec unofficial::brotli::brotlicommon)
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(BROTLIENC libbrotlienc)
|
||||
pkg_check_modules(BROTLIDEC libbrotlidec)
|
||||
if(BROTLIDEC_FOUND AND BROTLIENC_FOUND)
|
||||
target_link_libraries(cpprest PRIVATE ${BROTLIDEC_LDFLAGS} ${BROTLIENC_LDFLAGS})
|
||||
else(BROTLIDEC_FOUND AND BROTLIENC_FOUND)
|
||||
find_package(unofficial-brotli REQUIRED)
|
||||
add_library(cpprestsdk_brotli_internal INTERFACE)
|
||||
target_link_libraries(cpprestsdk_brotli_internal INTERFACE unofficial::brotli::brotlienc unofficial::brotli::brotlidec unofficial::brotli::brotlicommon)
|
||||
target_link_libraries(cpprest PRIVATE cpprestsdk_brotli_internal)
|
||||
endif(BROTLIDEC_FOUND AND BROTLIENC_FOUND)
|
||||
|
||||
endfunction()
|
||||
|
|
|
@ -84,7 +84,6 @@ else()
|
|||
target_compile_definitions(cpprest PRIVATE -DCPPREST_EXCLUDE_BROTLI=1)
|
||||
else()
|
||||
cpprest_find_brotli()
|
||||
target_link_libraries(cpprest PRIVATE cpprestsdk_brotli_internal)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче