1if(NOT trout_GOOGLETEST_ROOT_DIR)
2  set(trout_GOOGLETEST_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/googletest)
3endif()
4
5if(EXISTS "${trout_GOOGLETEST_ROOT_DIR}/CMakeLists.txt")
6  if(TARGET ${_trout_GOOGLETEST_LIBRARY_NAME})
7    set(trout_GOOGLETEST_LIBRARIES ${_trout_GOOGLETEST_LIBRARY_NAME})
8  else()
9    set(trout_GOOGLETEST_LIBRARIES "gtest")
10  endif()
11  if (NOT TARGET ${trout_GOOGLETEST_LIBRARIES})
12    add_subdirectory(${trout_GOOGLETEST_ROOT_DIR} third_party/googletest)
13  endif()
14else()
15  message(FATAL_ERROR "${trout_GOOGLETEST_ROOT_DIR}/CMakeLists.txt not found")
16endif()
17