From 068f60c92b74ed5d8c5ea651a4217169752b3caa Mon Sep 17 00:00:00 2001 From: Aaron Jomy Date: Wed, 15 Oct 2025 14:37:26 +0200 Subject: [PATCH] Try `find_package(gtest)` when configuring testing From https://github.com/root-project/root/pull/20011/commits/72b979a1646b4c758b0cc2393087a132af9816fc Prevents failures in offline builds that cannot fetch gtest. We now first look for gtest and suggest disabling testing if it is not found --- unittests/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/unittests/CMakeLists.txt b/unittests/CMakeLists.txt index f13b85f68..3d13205b5 100644 --- a/unittests/CMakeLists.txt +++ b/unittests/CMakeLists.txt @@ -4,7 +4,11 @@ enable_testing() # LLVM builds (not installed llvm) provides gtest. if (NOT TARGET GTest::gtest AND NOT TARGET gtest) - include(GoogleTest) + find_package(GTest) + if (NOT GTest_FOUND) + message(WARNING "CppInterOp could not find GTest. Provide the package or set CPPINTEROP_ENABLE_TESTING=OFF to disable this warning.") + return() + endif() endif() if(EMSCRIPTEN)