title: Compile gtest from source with catkin
body: <p>I am trying to compile gtest from source (instead of using the existing installed version). I am working on a catkin based cmake project.</p>
  
  <p>I have added the sourcecode from <a href="https://github.com/google/googletest" rel="nofollow noreferrer">https://github.com/google/googletest</a> to my workspace and included the folder with add_subdirectory.</p>
  
  <p>However, I get a nameclash with the existing gtest:</p>
  
  <pre><code>CMake Error at src/test_env/GTest/googletest/cmake/internal_utils.cmake:151 (add_library):
    add_library cannot create target "gtest" because another target with the
    same name already exists.  The existing target is a shared library created
    in source directory "/usr/src/gtest".  See documentation for policy CMP0002
    for more details.
  </code></pre>
  
  <p>From other posts, and the googletest instructions itself (<a href="https://github.com/google/googletest/tree/master/googletest#incorporating-into-an-existing-cmake-project" rel="nofollow noreferrer">https://github.com/google/googletest/tree/master/googletest#incorporating-into-an-existing-cmake-project</a>) I understand that this should be no problem. </p>
  
  <p>I think the problem might lie in how catkin handles gtest. And, admittedly, normally I could just use the installed version. But I want to make sure, that everyone uses the same (bundled) version of gtest.</p>
  
  <p>Any suggestions and hints are welcomed.</p>