diff options
Diffstat (limited to 'Firestore/CMakeLists.txt')
-rw-r--r-- | Firestore/CMakeLists.txt | 45 |
1 files changed, 43 insertions, 2 deletions
diff --git a/Firestore/CMakeLists.txt b/Firestore/CMakeLists.txt index cbcd49d..039cb06 100644 --- a/Firestore/CMakeLists.txt +++ b/Firestore/CMakeLists.txt @@ -42,9 +42,8 @@ if(APPLE) find_package(FirebaseCore REQUIRED) find_package(GoogleUtilities REQUIRED) endif() -find_package(GRPC REQUIRED) find_package(LevelDB REQUIRED) -find_package(Protobuf REQUIRED) +find_package(ZLIB) # Googletest @@ -64,6 +63,48 @@ add_subdirectory( ) +# gRPC +if(ZLIB_FOUND) + set(gRPC_ZLIB_PROVIDER package CACHE STRING "Use external ZLIB") +endif() + +set(gRPC_BUILD_TESTS OFF CACHE BOOL "Disable gRPC tests") +add_subdirectory( + ${FIREBASE_BINARY_DIR}/src/grpc + ${FIREBASE_BINARY_DIR}/src/grpc-build + EXCLUDE_FROM_ALL +) + +# Fix up targets included by gRPC's build +add_alias(OpenSSL::Crypto crypto) +target_include_directories( + crypto + INTERFACE + $<BUILD_INTERFACE:${FIREBASE_BINARY_DIR}/src/grpc/third_party/boringssl/include> +) + +add_alias(OpenSSL::SSL ssl) +target_include_directories( + ssl + INTERFACE + $<BUILD_INTERFACE:${FIREBASE_BINARY_DIR}/src/grpc/third_party/boringssl/include> +) + +add_alias(protobuf::libprotobuf libprotobuf) +target_compile_options( + libprotobuf + PUBLIC -Wno-unused-parameter +) + +if(NOT ZLIB_FOUND) + target_include_directories( + zlibstatic + INTERFACE + $<BUILD_INTERFACE:${FIREBASE_BINARY_DIR}/src/grpc/third_party/zlib> + ) +endif() + + # nanopb set(nanopb_BUILD_GENERATOR ON CACHE BOOL "Enable the nanopb generator") set(nanopb_PROTOC_PATH ${NANOPB_PROTOC_BIN} CACHE STRING "Protoc location") |