Skip to content

Commit

Permalink
tests: allow using system gtest copy
Browse files Browse the repository at this point in the history
Distributions often do builds with no network access available
for both security reasons and also to ensure reproducibility.

This change tells CMake to query the system for a copy of gtest,
but if it's not available, it'll fall back to downloading via
FetchContent.
  • Loading branch information
thesamesam authored and serge1 committed Nov 19, 2022
1 parent a04810f commit a52cccf
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/9a32aee22d771387c494be2d8519fbdf46a713b2.zip
FIND_PACKAGE_ARGS NAMES GTest
)

# For Windows: Prevent overriding the parent project's compiler/linker settings
Expand Down Expand Up @@ -44,7 +45,8 @@ target_link_libraries(
ELFIOTest
PRIVATE
elfio::elfio
gtest_main)
gtest_main
GTest::gtest_main)

add_test(
NAME
Expand Down

0 comments on commit a52cccf

Please sign in to comment.