File tree Expand file tree Collapse file tree 2 files changed +24
-6
lines changed
Expand file tree Collapse file tree 2 files changed +24
-6
lines changed Original file line number Diff line number Diff line change @@ -172,13 +172,23 @@ If you want to build DLLs, run `cmake` with `-DBUILD_SHARED_LIBS=ON`.
172172
173173### Dependency management
174174
175- gRPC's CMake build system provides two modes for handling dependencies.
176- * module - build dependencies alongside gRPC.
177- * package - use external copies of dependencies that are already available
178- on your system.
175+ gRPC's CMake build system has two options for handling dependencies.
176+ CMake can build the dependencies for you, or it can search for libraries
177+ that are already installed on your system and use them to build gRPC.
179178
180179This behavior is controlled by the ` gRPC_<depname>_PROVIDER ` CMake variables,
181- ie ` gRPC_CARES_PROVIDER ` .
180+ e.g. ` gRPC_CARES_PROVIDER ` . The options that these variables take are as follows:
181+
182+ * module - build dependencies alongside gRPC. The source code is obtained from
183+ gRPC's git submodules.
184+ * package - use external copies of dependencies that are already available
185+ on your system. These could come from your system package manager, or perhaps
186+ you pre-installed them using CMake with the ` CMAKE_INSTALL_PREFIX ` option.
187+
188+ For example, if you set ` gRPC_CARES_PROVIDER=module ` , then CMake will build
189+ c-ares before building gRPC. On the other hand, if you set
190+ ` gRPC_CARES_PROVIDER=package ` , then CMake will search for a copy of c-ares
191+ that's already installed on your system and use it to build gRPC.
182192
183193### Install after build
184194
Original file line number Diff line number Diff line change @@ -70,18 +70,26 @@ also sets up an `add_subdirectory()` rule for you. This causes gRPC to be
7070built as part of your project.
7171
7272``` cmake
73+ cmake_minimum_required(VERSION 3.15)
74+ project(my_project)
75+
7376include(FetchContent)
7477FetchContent_Declare(
7578 gRPC
7679 GIT_REPOSITORY https://github.com/grpc/grpc
77- GIT_TAG v1.25 .0
80+ GIT_TAG RELEASE_TAG_HERE # e.g v1.28 .0
7881)
82+ set(FETCHCONTENT_QUIET OFF)
7983FetchContent_MakeAvailable(gRPC)
8084
8185add_executable(my_exe my_exe.cc)
8286target_link_libraries(my_exe grpc++)
8387```
8488
89+ Note that you need to
90+ [ install the prerequisites] ( ../../BUILDING.md#pre-requisites )
91+ before building gRPC.
92+
8593### git submodule
8694If you cannot use FetchContent, another approach is to add the gRPC source tree
8795to your project as a
You can’t perform that action at this time.
0 commit comments