title: Building gRPC C++ with CMake on Linux
body: <p>I'm trying to build gRPC (cpp) using CMake, but running into errors. I am able to successfully build gRPC with <code>make</code> per the instructions on the <a href="https://github.com/grpc/grpc/blob/master/BUILDING.md" rel="nofollow noreferrer">gRPC cpp page</a>. Using <code>make</code> is deprecated, but CMake isn't working for me.</p>
  
  <p>After following the instructions for downloading, cloning etc., I go to the "Building with CMake", where it says for Linux/Unix, do this:</p>
  
  <pre><code>$ mkdir -p cmake/build
  $ cd cmake/build
  $ cmake ../..
  $ make
  </code></pre>
  
  <p>For me, it fails at the 3rd line (<code>cmake</code>). The following is the output:</p>
  
  <pre><code>$ cmake ../..
  -- The C compiler identification is GNU 7.4.0
  -- The CXX compiler identification is GNU 7.4.0
  -- Check for working C compiler: /usr/bin/cc
  -- Check for working C compiler: /usr/bin/cc -- works
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- Check for working CXX compiler: /usr/bin/c++
  -- Check for working CXX compiler: /usr/bin/c++ -- works
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  CMake Error at CMakeLists.txt:138 (include):
    include could not find load file:
  
      cmake/zlib.cmake
  
  &lt; repeats above error for the following .cmake files: cares, protobuf, ssl, gflags, benchmark, address_sorting and nanopb&gt;
  </code></pre>
  
  <p>Those files (<code>cmake/&lt;package name&gt;.cmake</code>) don't exist in the <code>cmake/</code> directory on my system. I'm not sure what in the CMakeLists.txt file would cause them to appear there.</p>
  
  <p>Researching this issue, I tried various combinations of <code>cmake</code> options such as <code>-DBUILD_SHARED_LIBS=ON</code>, <code>-DgRPC_INSTALL=ON</code>, and <code>-DgRPC&lt;package_name&gt;_PROVIDER=package</code> for each of the fails listed above. I always get the same errors. Finally, I tried running the <code>run_distrib_test_cmake.sh</code> script. It eventually failed the same way.</p>
  
  <p>Any ideas?</p>