Skip to content

Commit 068f60c

Browse files
committed
Try find_package(gtest) when configuring testing
From root-project/root@72b979a Prevents failures in offline builds that cannot fetch gtest. We now first look for gtest and suggest disabling testing if it is not found
1 parent e1e07e0 commit 068f60c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

unittests/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ enable_testing()
44

55
# LLVM builds (not installed llvm) provides gtest.
66
if (NOT TARGET GTest::gtest AND NOT TARGET gtest)
7-
include(GoogleTest)
7+
find_package(GTest)
8+
if (NOT GTest_FOUND)
9+
message(WARNING "CppInterOp could not find GTest. Provide the package or set CPPINTEROP_ENABLE_TESTING=OFF to disable this warning.")
10+
return()
11+
endif()
812
endif()
913

1014
if(EMSCRIPTEN)

0 commit comments

Comments
 (0)