How to fix CMake: Could not find a package configuration file provided by "gRPC"

Problem

When trying to build a C++ project that depends on gRPC, you might encounter the following error:

example.txt
CMake Error at CMakeLists.txt:37 (find_package):
  Could not find a package configuration file provided by "gRPC" with any of
  the following names:

    gRPCConfig.cmake
    grpc-config.cmake

  Add the installation prefix of "gRPC" to CMAKE_PREFIX_PATH or set
  "gRPC_DIR" to a directory containing one of the above files.  If "gRPC"
  provides a separate development package or SDK, be sure it has been
  installed.

Solution

You need to install libgrpc-dev to get the necessary CMake configuration files for gRPC. You can do this using the following command:

install-grpc-dev.sh
sudo apt -y install libgrpc-dev

Check out similar posts by category: C/C++