CMakeLists.txt: fix dependencies for shared library build

There are a small number of references to the GoogleTest
package (for example TempDir) from re2/testing/*.cc, so
the testing library itself must depend on GoogleTest.
I removed this dependency incorrectly. Only the shared-library
build hits this problem.

Change-Id: Id48d106449f8023fd40330bfef179ab1dd1d4f45
Reviewed-on: https://code-review.googlesource.com/c/re2/+/63791
Reviewed-by: Alan Donovan <adonovan@google.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 38b126f..81b4af2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -186,7 +186,7 @@
     target_compile_definitions(testing PRIVATE -DRE2_BUILD_TESTING_DLL)
   endif()
   target_compile_features(testing PUBLIC ${RE2_CXX_VERSION})
-  target_link_libraries(testing PUBLIC re2)
+  target_link_libraries(testing PUBLIC re2 GTest::gtest)
 
   if(RE2_BUILD_TESTING OR RE2_TEST)
     if(NOT TARGET GTest::gtest)