Skip to content

Commit

Permalink
Use FetchContent() for googletest (#1310)
Browse files Browse the repository at this point in the history
Use FetchContent to make googletest available. This resolves the problem of multiple googletest targets when using external projects which also come with googletest, e.g. the c_bindings once they are a standalone project.
  • Loading branch information
havogt authored May 27, 2019
1 parent 603b5d3 commit acdeb59
Show file tree
Hide file tree
Showing 328 changed files with 14 additions and 137,380 deletions.
16 changes: 14 additions & 2 deletions cmake/testing.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,20 @@ target_link_libraries( GridToolsTest INTERFACE Threads::Threads)
include(workaround_threads)
_fix_threads_flags()

option(INSTALL_GTEST OFF)
add_subdirectory(./tools/googletest)
include(FetchContent)
option(INSTALL_GTEST OFF) #TODO replace with set(INSTALL_GTEST OFF) with CMake >= 3.13
mark_as_advanced(INSTALL_GTEST)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.8.1
)
# TODO Replace the next 5 lines with `FetchContent_MakeAvailable(googletest)` once we upgrade to CMake 3.14+.
FetchContent_GetProperties(googletest)
if(NOT googletest_POPULATED)
FetchContent_Populate(googletest)
add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR})
endif()

if( NOT GT_GCL_ONLY )
if( GT_USE_MPI )
Expand Down
54 changes: 0 additions & 54 deletions tools/googletest/.gitignore

This file was deleted.

81 changes: 0 additions & 81 deletions tools/googletest/.travis.yml

This file was deleted.

180 changes: 0 additions & 180 deletions tools/googletest/BUILD.bazel

This file was deleted.

23 changes: 0 additions & 23 deletions tools/googletest/CMakeLists.txt

This file was deleted.

Loading

0 comments on commit acdeb59

Please sign in to comment.