Skip to content

Commit 48b373f

Browse files
committed
Allow using external absl and re2.
1 parent 76bb2af commit 48b373f

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@ option(BUILD_GMOCK "Builds the googlemock subproject" ON)
2020
option(INSTALL_GTEST "Enable installation of googletest. (Projects embedding googletest may want to turn this OFF.)" ON)
2121
option(GTEST_HAS_ABSL "Use Abseil and RE2. Requires Abseil and RE2 to be separately added to the build." OFF)
2222

23+
if(GTEST_HAS_ABSL)
24+
if(NOT TARGET absl::base)
25+
find_package(absl REQUIRED)
26+
endif()
27+
if(NOT TARGET re2::re2)
28+
find_package(re2 REQUIRED)
29+
endif()
30+
endif()
31+
2332
if(BUILD_GMOCK)
2433
add_subdirectory( googlemock )
2534
else()

googletest/cmake/Config.cmake.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ if (@GTEST_HAS_PTHREAD@)
44
set(THREADS_PREFER_PTHREAD_FLAG @THREADS_PREFER_PTHREAD_FLAG@)
55
find_dependency(Threads)
66
endif()
7+
if (@GTEST_HAS_ABSL@)
8+
find_dependency(absl)
9+
find_dependency(re2)
10+
endif()
711

812
include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]")
913
check_required_components("@project_name@")

0 commit comments

Comments
 (0)