Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 1 | Description: Find system brotli |
| 2 | Author: Gianfranco Costamagna <locutusofborg@debian.org> |
| 3 | Forwarded: https://github.com/Microsoft/cpprestsdk/pull/952 |
| 4 | Last-Update: 2018-11-05 |
| 5 | |
| 6 | --- cpprest-2.10.7.orig/Release/cmake/cpprest_find_brotli.cmake |
| 7 | +++ cpprest-2.10.7/Release/cmake/cpprest_find_brotli.cmake |
| 8 | @@ -3,8 +3,17 @@ function(cpprest_find_brotli) |
| 9 | return() |
| 10 | endif() |
| 11 | |
| 12 | - find_package(unofficial-brotli REQUIRED) |
| 13 | |
| 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 | + find_package(PkgConfig) |
| 17 | + pkg_check_modules(BROTLIENC libbrotlienc) |
| 18 | + pkg_check_modules(BROTLIDEC libbrotlidec) |
| 19 | + if(BROTLIDEC_FOUND AND BROTLIENC_FOUND) |
| 20 | + target_link_libraries(cpprest PRIVATE ${BROTLIDEC_LDFLAGS} ${BROTLIENC_LDFLAGS}) |
| 21 | + else(BROTLIDEC_FOUND AND BROTLIENC_FOUND) |
| 22 | + find_package(unofficial-brotli REQUIRED) |
| 23 | + add_library(cpprestsdk_brotli_internal INTERFACE) |
| 24 | + target_link_libraries(cpprestsdk_brotli_internal INTERFACE unofficial::brotli::brotlienc unofficial::brotli::brotlidec unofficial::brotli::brotlicommon) |
| 25 | + target_link_libraries(cpprest PRIVATE cpprestsdk_brotli_internal) |
| 26 | + endif(BROTLIDEC_FOUND AND BROTLIENC_FOUND) |
| 27 | + |
| 28 | endfunction() |
| 29 | --- cpprest-2.10.7.orig/Release/src/CMakeLists.txt |
| 30 | +++ cpprest-2.10.7/Release/src/CMakeLists.txt |
| 31 | @@ -84,7 +84,6 @@ else() |
| 32 | target_compile_definitions(cpprest PRIVATE -DCPPREST_EXCLUDE_BROTLI=1) |
| 33 | else() |
| 34 | cpprest_find_brotli() |
| 35 | - target_link_libraries(cpprest PRIVATE cpprestsdk_brotli_internal) |
| 36 | endif() |
| 37 | endif() |
| 38 | |