aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmake/external/grpc.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/external/grpc.cmake')
-rw-r--r--cmake/external/grpc.cmake45
1 files changed, 28 insertions, 17 deletions
diff --git a/cmake/external/grpc.cmake b/cmake/external/grpc.cmake
index ee4d246..a789838 100644
--- a/cmake/external/grpc.cmake
+++ b/cmake/external/grpc.cmake
@@ -14,7 +14,6 @@
include(ExternalProject)
include(ExternalProjectFlags)
-include(FindZLIB)
if(GRPC_ROOT)
# If the user has supplied a GRPC_ROOT then just use it. Add an empty custom
@@ -25,7 +24,6 @@ else()
set(
GIT_SUBMODULES
third_party/boringssl
- third_party/cares/cares
)
set(
@@ -47,44 +45,55 @@ else()
)
+ ## c-ares
+ if(NOT c-ares_DIR)
+ set(c-ares_DIR ${FIREBASE_INSTALL_DIR}/lib/cmake/c-ares)
+ endif()
+
+ list(
+ APPEND CMAKE_ARGS
+ -DgRPC_CARES_PROVIDER:STRING=package
+ -Dc-ares_DIR:PATH=${c-ares_DIR}
+ )
+
+
## protobuf
# Unlike other dependencies of gRPC, we control the protobuf version because we
# have checked-in protoc outputs that must match the runtime.
# The location where protobuf-config.cmake will be installed varies by platform
- if (WIN32)
- set(PROTOBUF_CMAKE_DIR "${FIREBASE_INSTALL_DIR}/cmake")
- else()
- set(PROTOBUF_CMAKE_DIR "${FIREBASE_INSTALL_DIR}/lib/cmake/protobuf")
+ if(NOT Protobuf_DIR)
+ if(WIN32)
+ set(Protobuf_DIR "${FIREBASE_INSTALL_DIR}/cmake")
+ else()
+ set(Protobuf_DIR "${FIREBASE_INSTALL_DIR}/lib/cmake/protobuf")
+ endif()
endif()
list(
APPEND CMAKE_ARGS
-DgRPC_PROTOBUF_PROVIDER:STRING=package
-DgRPC_PROTOBUF_PACKAGE_TYPE:STRING=CONFIG
- -DProtobuf_DIR:PATH=${PROTOBUF_CMAKE_DIR}
+ -DProtobuf_DIR:PATH=${Protobuf_DIR}
)
## zlib
- # zlib can be built by grpc but we can avoid it on platforms that provide it
- # by default.
- find_package(ZLIB)
+ # cmake/external/zlib.cmake figures out whether or not to build zlib. Either
+ # way, from the gRPC build's point of view it's a package.
+ list(
+ APPEND CMAKE_ARGS
+ -DgRPC_ZLIB_PROVIDER:STRING=package
+ )
if(ZLIB_FOUND)
+ # Propagate possible user configuration to FindZLIB.cmake in the sub-build.
list(
APPEND CMAKE_ARGS
- -DgRPC_ZLIB_PROVIDER:STRING=package
-DZLIB_INCLUDE_DIR=${ZLIB_INCLUDE_DIR}
-DZLIB_LIBRARY=${ZLIB_LIBRARY}
)
-
- else()
- list(
- APPEND GIT_SUBMODULES
- third_party/zlib
- )
endif()
@@ -98,7 +107,9 @@ else()
ExternalProject_Add(
grpc
DEPENDS
+ c-ares
protobuf
+ zlib
${GRPC_GIT}