Skip to content

Commit 17197f4

Browse files
committed
Move GTest lookup into tests
For some reason, the tests can't find the imported GTest targets otherwise.
1 parent 7e3c8e3 commit 17197f4

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

lib/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,3 @@ if(NOT USE_SYSTEM_ARGS)
7676

7777
import_args()
7878
endif()
79-
80-
# Google Test framework
81-
if(BUILD_TESTING AND NOT TARGET GTest::gtest)
82-
find_package(GTest REQUIRED)
83-
endif()

tests/CMakeLists.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
enable_testing()
22
include(CTest)
33

4-
set(CMAKE_CXX_STANDARD 11)
4+
set(CMAKE_CXX_STANDARD 17)
5+
6+
find_package(GTest REQUIRED)
57

68
add_executable(test_zsutil test_zsutil.cpp)
79
target_link_libraries(test_zsutil PRIVATE libzsync2 GTest::gtest cpr)
8-
add_test(NAME test_zsutil COMMAND test_zsutil)
10+
gtest_discover_tests(test_zsutil)
911

1012
add_executable(test_zshash test_zshash.cpp)
1113
target_link_libraries(test_zshash PRIVATE libzsync2 GTest::gtest cpr)
12-
add_test(NAME test_zshash COMMAND test_zshash)
14+
gtest_discover_tests(test_zshash)

0 commit comments

Comments
 (0)