googletest: new version, absl support, c++20 flag (#48328)

* googletest: new version, absl support, c++20 flag
* Update googletest header
This commit is contained in:
Seth R. Johnson 2025-01-08 14:22:38 -05:00 committed by GitHub
parent c424611010
commit 1c9b042d3a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 7 deletions

View File

@ -93,7 +93,7 @@ class AbseilCpp(CMakePackage):
depends_on("cmake@3.5:", when="@20190312:", type="build") depends_on("cmake@3.5:", when="@20190312:", type="build")
depends_on("cmake@3.1:", type="build") depends_on("cmake@3.1:", type="build")
depends_on("googletest", type="build", when="@20220623:") depends_on("googletest~absl", type="test", when="@20220623:")
def cmake_args(self): def cmake_args(self):
run_tests = self.run_tests and self.spec.satisfies("@20220623:") run_tests = self.run_tests and self.spec.satisfies("@20220623:")

View File

@ -15,6 +15,8 @@ class Googletest(CMakePackage):
maintainers("sethrj") maintainers("sethrj")
version("main", branch="main") version("main", branch="main")
version("1.15.2", sha256="7b42b4d6ed48810c5362c265a17faebe90dc2373c885e5216439d37927f02926")
version("1.15.0", sha256="7315acb6bf10e99f332c8a43f00d5fbb1ee6ca48c52f6b936991b216c586aaad")
version("1.14.0", sha256="8ad598c73ad796e0d8280b082cebd82a630d73e73cd3c70057938a6501bba5d7") version("1.14.0", sha256="8ad598c73ad796e0d8280b082cebd82a630d73e73cd3c70057938a6501bba5d7")
version("1.13.0", sha256="ad7fdba11ea011c1d925b3289cf4af2c66a352e18d4c7264392fead75e919363") version("1.13.0", sha256="ad7fdba11ea011c1d925b3289cf4af2c66a352e18d4c7264392fead75e919363")
version("1.12.1", sha256="81964fe578e9bd7c94dfdb09c8e4d6e6759e19967e397dbea48d1c10e45d0df2") version("1.12.1", sha256="81964fe578e9bd7c94dfdb09c8e4d6e6759e19967e397dbea48d1c10e45d0df2")
@ -29,14 +31,18 @@ class Googletest(CMakePackage):
depends_on("c", type="build") depends_on("c", type="build")
depends_on("cxx", type="build") depends_on("cxx", type="build")
variant("absl", default=False, when="@1.12.1:", description="Build with abseil and RE2")
depends_on("abseil-cpp", when="+absl")
depends_on("re2", when="+absl")
variant("gmock", default=True, when="@1.8:", description="Build with gmock") variant("gmock", default=True, when="@1.8:", description="Build with gmock")
variant("pthreads", default=True, description="Build multithreaded version with pthreads") variant("pthreads", default=True, description="Build multithreaded version with pthreads")
variant("shared", default=True, description="Build shared libraries (DLLs)") variant("shared", default=True, description="Build shared libraries (DLLs)")
variant( variant(
"cxxstd", "cxxstd",
default="11", default="14",
values=("98", "11", "14", "17"), values=("98", "11", "14", "17", "20"),
multi=False, multi=False,
description="Use the specified C++ standard when building", description="Use the specified C++ standard when building",
) )
@ -48,12 +54,13 @@ def cmake_args(self):
args = [ args = [
self.define_from_variant("BUILD_SHARED_LIBS", "shared"), self.define_from_variant("BUILD_SHARED_LIBS", "shared"),
self.define_from_variant("CMAKE_CXX_STANDARD", "cxxstd"), self.define_from_variant("CMAKE_CXX_STANDARD", "cxxstd"),
self.define_from_variant("BUILD_GMOCK", "gmock"),
self.define_from_variant("GTEST_HAS_ABSL", "absl"),
self.define("gtest_disable_pthreads", spec.satisfies("~pthreads")),
] ]
args.append(self.define("gtest_disable_pthreads", not spec.satisfies("+pthreads")))
if spec.satisfies("@1.8:"): if spec.satisfies("@:1.8.0"):
# New style (contains both Google Mock and Google Test)
args.append(self.define("BUILD_GTEST", True)) args.append(self.define("BUILD_GTEST", True))
args.append(self.define_from_variant("BUILD_GMOCK", "gmock"))
return args return args