dev-cpp/gtest: add support for abseil and re2

Use abseil for functionality such as using AbslStringify for extensible
print formatting, and use re2 for regex engine and syntax.

Signed-off-by: Peter Levine <plevine457@gmail.com>
Signed-off-by: Florian Schmaus <flow@gentoo.org>
This commit is contained in:
Peter Levine
2024-10-14 09:14:00 +02:00
committed by Florian Schmaus
parent c8ab83d2bb
commit a9924d310c
3 changed files with 45 additions and 1 deletions
@@ -0,0 +1,32 @@
dev-libs/re2 is built with a Makefile which doesn't install any cmake modules.
For now, use pkgconfig.
Bug: https://bugs.gentoo.org/940734
Signed-off-by: Peter Levine <plevine457@gmail.com>
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -25,7 +25,9 @@
find_package(absl REQUIRED)
endif()
if(NOT TARGET re2::re2)
- find_package(re2 REQUIRED)
+ find_package(PkgConfig REQUIRED)
+ pkg_check_modules(re2 REQUIRED IMPORTED_TARGET re2)
+ add_library(re2::re2 ALIAS PkgConfig::re2)
endif()
endif()
--- a/googletest/cmake/Config.cmake.in
+++ b/googletest/cmake/Config.cmake.in
@@ -6,7 +6,9 @@
endif()
if (@GTEST_HAS_ABSL@)
find_dependency(absl)
- find_dependency(re2)
+ find_package(PkgConfig)
+ pkg_check_modules(re2 IMPORTED_TARGET re2)
+ add_library(re2::re2 ALIAS PkgConfig::re2)
endif()
include("${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake")
+8 -1
View File
@@ -29,14 +29,20 @@ HOMEPAGE="https://github.com/google/googletest"
LICENSE="BSD"
SLOT="0"
IUSE="doc examples test"
IUSE="abseil doc examples test"
RESTRICT="!test? ( test )"
BDEPEND="test? ( ${PYTHON_DEPS} )"
DEPEND="abseil? (
dev-cpp/abseil-cpp:=[${MULTILIB_USEDEP}]
dev-libs/re2:=[${MULTILIB_USEDEP}] )"
RDEPEND="${DEPEND}"
# Exclude tests that fail with FEATURES="usersandbox"
CMAKE_SKIP_TESTS=( "googletest-(death-test|port)-test" )
PATCHES=( "${FILESDIR}"/gtest-find-re2-with-pkgconfig.patch )
pkg_setup() {
use test && python-any-r1_pkg_setup
}
@@ -49,6 +55,7 @@ multilib_src_configure() {
local mycmakeargs=(
-DBUILD_GMOCK=ON
-DINSTALL_GTEST=ON
-DGTEST_HAS_ABSL=$(usex abseil)
# tests
-Dgmock_build_tests=$(usex test)
+5
View File
@@ -9,6 +9,11 @@
<email>proxy-maint@gentoo.org</email>
<name>Proxy Maintainers</name>
</maintainer>
<use>
<flag name="abseil">
Build with functionality provided by <pkg>dev-cpp/abseil-cpp</pkg> and <pkg>dev-libs/re2</pkg>
</flag>
</use>
<upstream>
<doc lang="en">https://github.com/google/googletest/tree/HEAD/docs</doc>
<remote-id type="github">google/googletest</remote-id>