# vim: ft=cmake

# This is a separate template for CMakeLists.txt to build gtest as a separate project
#
# Copied from upstream documentation:
# https://github.com/google/googletest/tree/master/googletest#incorporating-into-an-existing-cmake-project

cmake_minimum_required(VERSION 2.8.12)

project(googletest-download NONE)

include(ExternalProject)
ExternalProject_Add(googletest
  GIT_REPOSITORY    https://github.com/google/googletest.git
  #GIT_TAG           master
  # build from a stable tag instead of master branch (which gets broken pretty often)
  GIT_TAG           release-1.11.0
  SOURCE_DIR        "${CMAKE_BINARY_DIR}/googletest-src"
  BINARY_DIR        "${CMAKE_BINARY_DIR}/googletest-build"
  CONFIGURE_COMMAND ""
  BUILD_COMMAND     ""
  INSTALL_COMMAND   ""
  TEST_COMMAND      ""
  # Disable update of the external project in an offline build
  # reference: https://stackoverflow.com/a/40423683
  UPDATE_DISCONNECTED ${OFFLINE_BUILD}
)
