From 590dac2b3b9e75f82f433f382b6a06856e12d378 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Mon, 26 Jan 2026 15:44:18 -0800 Subject: [PATCH] gtest: Add optional abseil-cpp support or-tools 9.15 will require gtest built with abseil-cpp, but abseil-cpp itself requires gtest built without abseil-cpp to avoid infinite recursion, so make it configurable (defaulting to false to reduce rebuilds). Signed-off-by: Anders Kaseorg --- pkgs/by-name/gt/gtest/package.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/gt/gtest/package.nix b/pkgs/by-name/gt/gtest/package.nix index c31700e6e8a2..f49c4439ddfd 100644 --- a/pkgs/by-name/gt/gtest/package.nix +++ b/pkgs/by-name/gt/gtest/package.nix @@ -4,6 +4,9 @@ fetchFromGitHub, cmake, ninja, + withAbseil ? false, + abseil-cpp, + re2, # Enable C++17 support # https://github.com/google/googletest/issues/3081 # Projects that require a higher standard can override this package. @@ -47,6 +50,10 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ cmake ninja + ] + ++ lib.optionals withAbseil [ + abseil-cpp + re2 ]; cmakeFlags = [ @@ -54,7 +61,8 @@ stdenv.mkDerivation rec { ] ++ lib.optionals (cxx_standard != null) [ "-DCMAKE_CXX_STANDARD=${cxx_standard}" - ]; + ] + ++ lib.optional withAbseil "-DGTEST_HAS_ABSL=ON"; meta = { description = "Google's framework for writing C++ tests";