| 1 |
function(cpprest_find_brotli) |
| 2 |
if(TARGET cpprestsdk_brotli_internal) |
| 3 |
return() |
| 4 |
endif() |
| 5 |
|
| 6 |
|
| 7 |
find_package(PkgConfig) |
| 8 |
pkg_check_modules(BROTLIENC libbrotlienc) |
| 9 |
pkg_check_modules(BROTLIDEC libbrotlidec) |
| 10 |
if(BROTLIDEC_FOUND AND BROTLIENC_FOUND) |
| 11 |
target_link_libraries(cpprest PRIVATE ${BROTLIDEC_LDFLAGS} ${BROTLIENC_LDFLAGS}) |
| 12 |
else(BROTLIDEC_FOUND AND BROTLIENC_FOUND) |
| 13 |
find_package(unofficial-brotli REQUIRED) |
| 14 |
add_library(cpprestsdk_brotli_internal INTERFACE) |
| 15 |
target_link_libraries(cpprestsdk_brotli_internal INTERFACE unofficial::brotli::brotlienc unofficial::brotli::brotlidec unofficial::brotli::brotlicommon) |
| 16 |
target_link_libraries(cpprest PRIVATE cpprestsdk_brotli_internal) |
| 17 |
endif(BROTLIDEC_FOUND AND BROTLIENC_FOUND) |
| 18 |
|
| 19 |
endfunction() |