File tree Expand file tree Collapse file tree 3 files changed +23
-17
lines changed Expand file tree Collapse file tree 3 files changed +23
-17
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -3,10 +3,12 @@ cmake_minimum_required(VERSION 3.11.0)
33set (CMAKE_CXX_STANDARD 17)
44project (cpp11training)
55
6- include (AddGoogleTest.cmake)
76
87project (cpp11training)
98file (GLOB_RECURSE SOURCES "${CMAKE_CURRENT_SOURCE_DIR} /*.cpp" )
109add_executable (cpp11training ${SOURCES} )
1110include_directories (${CMAKE_CURRENT_SOURCE_DIR} )
12- target_link_libraries (cpp11training gtest gmock_main)
11+
12+ include (FetchGoogleTest.cmake)
13+ fetch_google_test()
14+ target_link_libraries (cpp11training gtest)
Original file line number Diff line number Diff line change 1+ cmake_minimum_required (VERSION 3.11.0)
2+
3+ include (FetchContent)
4+
5+ function (fetch_google_test)
6+ FetchContent_Declare(
7+ googletest
8+ GIT_REPOSITORY https://github.com/google/googletest.git
9+ GIT_TAG release-1.8.0
10+ )
11+ FetchContent_MakeAvailable(googletest)
12+ FetchContent_GetProperties(googletest)
13+ if (NOT googletest_POPULATED)
14+ message (Fetching googletest)
15+ FetchContent_Populate(googletest)
16+ add_subdirectory (${googletest_SOURCE_DIR} ${googletest_BINARY_DIR} )
17+ endif ()
18+ endfunction ()
19+
You can’t perform that action at this time.
0 commit comments