From c48f5066a6111769783e741dfceb866d33bc92cf Mon Sep 17 00:00:00 2001 From: Stephan Hageboeck Date: Tue, 30 Sep 2025 10:30:51 +0200 Subject: [PATCH 1/2] [InterOp] Fix a build failure on Gentoo. With llvm's include(Googletest), CppInterOp might download its own googletest, ignoring the system installation. This created several problems: - An existing system installation might be ignored. - When used in ROOT with builtin gtest, a conflicting gtest might be downloaded. - When ROOT is configured with fail-on-missing while offline, the configuration fails, because it is assumed that gtest needs to be downloaded. This is not the case, though, if gtest is present in the system. Therefore: - Test if the targets GTest::gtest or gtest exist. If found, no further actions are required. - New: If not found, run find_package(GTest). If found, continue as normal. - New: If not found, warn and disable the interop tests. --- interpreter/CppInterOp/unittests/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/interpreter/CppInterOp/unittests/CMakeLists.txt b/interpreter/CppInterOp/unittests/CMakeLists.txt index f13b85f68f497..3d13205b52aa6 100644 --- a/interpreter/CppInterOp/unittests/CMakeLists.txt +++ b/interpreter/CppInterOp/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) From 72b979a1646b4c758b0cc2393087a132af9816fc Mon Sep 17 00:00:00 2001 From: Stephan Hageboeck Date: Tue, 30 Sep 2025 11:06:32 +0200 Subject: [PATCH 2/2] [InterOp] Prevent a configure failure when offline. It was assumed that CppInterOp needs internet connection to download gtest. This should not be the case, any more, since it can use the system googletest or ROOT builtin targets. Therefore: - Remove the internet connnectivity check. It fails builds on Gentoo, because packages are always built without connection. - Change CPPINTEROP_ENABLE_TESTING from CACHE FORCE to CACHE. This enables users to override values when configuring. If they don't set any value, the value follows "testing=On/Off". --- interpreter/CMakeLists.txt | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/interpreter/CMakeLists.txt b/interpreter/CMakeLists.txt index a3bd904663cbf..9b9ed36cd00f1 100644 --- a/interpreter/CMakeLists.txt +++ b/interpreter/CMakeLists.txt @@ -557,14 +557,10 @@ set(CPPINTEROP_USE_CLING ON CACHE BOOL "" FORCE) set(CPPINTEROP_USE_REPL OFF CACHE BOOL "" FORCE) #---Disable testing on InterOp if ROOT's testing is OFF (InterOp tests are enabled by default) ------------------------------------------------------- -ROOT_CHECK_CONNECTION("CPPINTEROP_ENABLE_TESTING=OFF") -if(testing AND NOT NO_CONNECTION) - set(CPPINTEROP_ENABLE_TESTING ON CACHE BOOL "" FORCE) +if(testing) + set(CPPINTEROP_ENABLE_TESTING ON CACHE BOOL "Enable gtest in CppInterOp") else() - if(NO_CONNECTION) - message(STATUS "No internet connection, disabling the `CppInterOp testing infrastructure` option") - endif() - set(CPPINTEROP_ENABLE_TESTING OFF CACHE BOOL "") + set(CPPINTEROP_ENABLE_TESTING OFF CACHE BOOL "Enable gtest in CppInterOp") endif() add_subdirectory(CppInterOp)