blob: 9c092596b7512cd1d7b7323a11568c1776788c8d [file] [log] [blame]
James Kuszmaulcf324122023-01-14 14:07:17 -08001include(FetchContent)
2
Maxwell Henderson80bec322024-01-09 15:48:44 -08003fetchcontent_declare(
James Kuszmaulcf324122023-01-14 14:07:17 -08004 googletest
Maxwell Henderson80bec322024-01-09 15:48:44 -08005 GIT_REPOSITORY https://github.com/google/googletest.git
6 GIT_TAG
7 58d77fa8070e8cec2dc1ed015d66b454c8d78850 # 1.12.1
James Kuszmaulcf324122023-01-14 14:07:17 -08008)
9
Maxwell Henderson80bec322024-01-09 15:48:44 -080010fetchcontent_getproperties(googletest)
James Kuszmaulcf324122023-01-14 14:07:17 -080011if(NOT googletest_POPULATED)
Maxwell Henderson80bec322024-01-09 15:48:44 -080012 fetchcontent_populate(googletest)
James Kuszmaulcf324122023-01-14 14:07:17 -080013
14 # Prevent overriding the parent project's compiler/linker
15 # settings on Windows
16 set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
17
18 add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR} EXCLUDE_FROM_ALL)
Brian Silverman8fce7482020-01-05 13:18:21 -080019endif()
20
James Kuszmaulcf324122023-01-14 14:07:17 -080021target_compile_features(gtest PUBLIC cxx_std_20)
22target_compile_features(gtest_main PUBLIC cxx_std_20)
James Kuszmaulb13e13f2023-11-22 20:44:04 -080023target_compile_features(gmock PUBLIC cxx_std_20)
24target_compile_features(gmock_main PUBLIC cxx_std_20)