[gtest] Use googletest as a submodule (#1373)

Some Linux distributions use a hermetic build environment to build. This
resulted in issues with `FetchContent` attempting to download googletest
at configure time.
This fixes the issue by integrating googletest as a git submodule
instead of downloading it at configure time.
This commit is contained in:
Fabrice de Gans 2024-11-24 12:39:10 -08:00 committed by GitHub
parent a8ec85d536
commit dcb9ccca90
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 7 deletions

3
.gitmodules vendored
View File

@ -2,3 +2,6 @@
path = win32-deps
url = https://github.com/visualboyadvance-m/win32-deps.git
branch = master
[submodule "third_party/googletest"]
path = third_party/googletest
url = https://github.com/google/googletest.git

View File

@ -90,14 +90,9 @@ endif()
# Configure gtest
if(BUILD_TESTING)
FetchContent_Declare(googletest
URL https://github.com/google/googletest/archive/2d16ed055d09c3689d44b272adc097393de948a0.zip
EXCLUDE_FROM_ALL
)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
set(INSTALL_GTEST OFF CACHE BOOL "" FORCE)
add_subdirectory(./third_party/googletest)
include(GoogleTest)
endif()

1
third_party/googletest vendored Submodule

@ -0,0 +1 @@
Subproject commit b514bdc898e2951020cbdca1304b75f5950d1f59