Skip to content

Commit 66c5fa3

Browse files
yurivictabhinavdangeti
authored andcommitted
Use cmake's find_package to link to GTest (facebookresearch#3278)
Summary: Otherwise the gtest transitive dependency isn't linked properly when GoogleTest is built to have shared libraries. Pull Request resolved: facebookresearch#3278 Reviewed By: junjieqi Differential Revision: D55134304 Pulled By: algoriddle fbshipit-source-id: 01e7b11f28c27f837afee36350fbf9543e301a31
1 parent 811431c commit 66c5fa3

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

tests/CMakeLists.txt

+2-8
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,12 @@ if(FAISS_OPT_LEVEL STREQUAL "avx512")
5959
target_link_libraries(faiss_test PRIVATE faiss_avx512)
6060
endif()
6161

62-
include(FetchContent)
63-
FetchContent_Declare(googletest
64-
URL "https://github.com/google/googletest/archive/release-1.12.1.tar.gz")
65-
set(BUILD_GMOCK CACHE BOOL OFF)
66-
set(INSTALL_GTEST CACHE BOOL OFF)
67-
FetchContent_MakeAvailable(googletest)
68-
6962
find_package(OpenMP REQUIRED)
63+
find_package(GTest CONFIG REQUIRED)
7064

7165
target_link_libraries(faiss_test PRIVATE
7266
OpenMP::OpenMP_CXX
73-
gtest_main
67+
GTest::gtest_main
7468
$<$<BOOL:${FAISS_ENABLE_RAFT}>:raft::raft>
7569
)
7670

0 commit comments

Comments
 (0)