Reputation: 147
My project uses MySQL connector, which use OpenSSL as its dependency. I've integrate gRPC with my project using FetchContent, with OpenSSL installed in my system. But it still use BoringSSL.
Upvotes: 4
Views: 8116
Reputation: 8033
gRPC offers two ways to get its dependencies: with add_subdirectory
(I'm not a big fan of this way), and with find_package
(that's my favorite).
As documented here:
# Providers for third-party dependencies (gRPC_*_PROVIDER properties):
# "module": build the dependency using sources from git submodule (under third_party)
# "package": use cmake's find_package functionality to locate a pre-installed dependency
So in order to use your own SSL library, the best way is to:
find_package
, with -DgRPC_SSL_PROVIDER=package
.find_package
. Either because it is installed system-wide, or by using -DCMAKE_PREFIX_PATH
to help find_package
find it.Here is an example fetching and building gRPC and its dependencies from sources. Note this line in particular, where gRPC is instructed to use the "package" mode.
I would advise against adding set(gRPC_SSL_PROVIDER package)
to your CMakeLists.txt. This should not be a concern of your project's CMakeLists, hence it's better to pass it as a command (-DgRPC_SSL_PROVIDER=package
).
Upvotes: 1
Reputation: 1
We use gRPC by compiling source code. There was an issue (application segfault) due to which it was needed to to disable boringSSL for gRPC and use OpenSSL installed on the system. There are many suggestions. But the one that worked for me is below.
cmake -DgRPC_SSL_PROVIDER=OpenSSL . && make && make install
Upvotes: -1