title: How to clone and integrate external (from git) cmake project into local one
body: <p>I faced with a problem when I was trying to use Google Test. </p>
  
  <p>There are lot of manuals on how to use <code>ExternalProject_Add</code> for the adding gtest into the project, however most of these describe a method based on downloading zip archive with gtest and build it.</p>
  
  <p>As we know gtest is github-hosted and cmake-based project. So I'd like to find native cmake way.</p>
  
  <p>If this would be a header-only project, I'd write something like:</p>
  
  <pre><code>cmake_minimum_required(VERSION 2.8.8)
  include(ExternalProject)
  find_package(Git REQUIRED)
  
  ExternalProject_Add(
      gtest
      PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/ext
      GIT_REPOSITORY https://github.com/google/googletest.git
      TIMEOUT 10
      UPDATE_COMMAND ${GIT_EXECUTABLE} pull
      CONFIGURE_COMMAND ""
      BUILD_COMMAND ""
      INSTALL_COMMAND ""
      LOG_DOWNLOAD ON
  )
  
  ExternalProject_Get_Property(gtest source_dir)
  set(GTEST_INCLUDE_DIR ${source_dir}/googletest/include CACHE INTERNAL "Path to include folder for GTest")
  set(GTEST_ROOT_DIR ${source_dir}/googletest CACHE INTERNAL "Path to source folder for GTest")
  include_directories(${INCLUDE_DIRECTORIES} ${GTEST_INCLUDE_DIR} ${GTEST_ROOT_DIR})
  message(${GTEST_INCLUDE_DIR})
  </code></pre>
  
  <p>and add this script from my cmake project like:</p>
  
  <pre><code> set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake.modules/")
   include(AddGTest)
  ....
   add_dependencies(${PROJECT_NAME} gtest)
  </code></pre>
  
  <p>However this requires a build step.</p>
  
  <p>How should this be implemented? </p>
  
  <ol>
  <li>By adding <code>BUILD_COMMAND</code> into <code>ExternaProject_Add</code> and linking with produced libs?</li>
  <li>Or by including gtest's cmakelists into my project, something like this:</li>
  </ol>
  
  <p><code>add_subdirectory (${CMAKE_SOURCE_DIR}\ext\src\gtest\googletest\CMakeLists.txt)
  </code></p>
  
  <p>this is not correct way because on the moment of the project load the folder does not exist.</p>
  
  <ol start="3">
  <li>Any other ways? </li>
  </ol>
  
  <p>What is a correct/prefer way? </p>