Separate DLL export/import for test helpers dll, and fix typo.

The DLL export issue isn't a problem currently, since we don't explicitly export any symbols from the test dll.  This will be an issue in the future though.  Additionally, there was a typo in absl_internal_test_dll_contains that caused abseil_test_dll to be empty (and therefore not create a lib file).

PiperOrigin-RevId: 504555797
Change-Id: Ic7b50bcbe704f7c8fd44028071abcf5d6babb2cf
diff --git a/CMake/AbseilDll.cmake b/CMake/AbseilDll.cmake
index b0541de..c4a41e6 100644
--- a/CMake/AbseilDll.cmake
+++ b/CMake/AbseilDll.cmake
@@ -654,7 +654,7 @@
   STRING(REGEX REPLACE "^absl::" "" _target ${ABSL_INTERNAL_TEST_DLL_TARGET})
 
   list(FIND
-    ABSL_INTERNA_TEST_DLL_TARGETS
+    ABSL_INTERNAL_TEST_DLL_TARGETS
     "${_target}"
     _index)
 
@@ -703,14 +703,18 @@
     set(_dll "abseil_test_dll")
     set(_dll_files ${ABSL_INTERNAL_TEST_DLL_FILES})
     set(_dll_libs "abseil_dll" "GTest::gtest" "GTest::gmock")
-    set(_dll_compile_definiations "GTEST_LINKED_AS_SHARED_LIBRARY=1")
-    set(_dll_includes ${GMOCK_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS})
+    set(_dll_compile_definitions "GTEST_LINKED_AS_SHARED_LIBRARY=1")
+    set(_dll_includes ${absl_gtest_src_dir}/googletest/include ${absl_gtest_src_dir}/googlemock/include)
+    set(_dll_consume "ABSL_CONSUME_TEST_DLL")
+    set(_dll_build "ABSL_BUILD_TEST_DLL")
   else()
     set(_dll "abseil_dll")
     set(_dll_files ${ABSL_INTERNAL_DLL_FILES})
     set(_dll_libs "")
-    set(_dll_compile_definiations "")
+    set(_dll_compile_definitions "")
     set(_dll_includes "")
+    set(_dll_consume "ABSL_CONSUME_DLL")
+    set(_dll_build "ABSL_BUILD_DLL")
   endif()
 
   add_library(
@@ -762,7 +766,7 @@
 Description: Abseil DLL library\n\
 URL: https://abseil.io/\n\
 Version: ${absl_VERSION}\n\
-Libs: -L\${libdir} ${PC_LINKOPTS} $<$<NOT:$<BOOL:${ABSL_CC_LIB_IS_INTERFACE}>>:-labseil_dll>\n\
+Libs: -L\${libdir} ${PC_LINKOPTS} $<$<NOT:$<BOOL:${ABSL_CC_LIB_IS_INTERFACE}>>:-l${_dll}>\n\
 Cflags: -I\${includedir}${PC_CFLAGS}\n")
   INSTALL(FILES "${CMAKE_BINARY_DIR}/lib/pkgconfig/${_dll}.pc"
     DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
@@ -770,13 +774,13 @@
   target_compile_definitions(
     ${_dll}
     PUBLIC
-      GTEST_LINKED_AS_SHARED_LIBRARY=1
+      ${_dll_compile_definitions}
     PRIVATE
-      ABSL_BUILD_DLL
+      ${_dll_build}
       NOMINMAX
     INTERFACE
       ${ABSL_CC_LIB_DEFINES}
-      ABSL_CONSUME_DLL
+      ${_dll_consume}
   )
 
   if(ABSL_PROPAGATE_CXX_STD)
diff --git a/CMake/AbseilHelpers.cmake b/CMake/AbseilHelpers.cmake
index cfe5582..0c91aad 100644
--- a/CMake/AbseilHelpers.cmake
+++ b/CMake/AbseilHelpers.cmake
@@ -414,7 +414,7 @@
   target_sources(${_NAME} PRIVATE ${ABSL_CC_TEST_SRCS})
   target_include_directories(${_NAME}
     PUBLIC ${ABSL_COMMON_INCLUDE_DIRS}
-    PRIVATE ${GMOCK_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS}
+    PRIVATE ${absl_gtest_src_dir}/googletest/include ${absl_gtest_src_dir}/googlemock/include
   )
 
   if (${ABSL_BUILD_DLL})
@@ -422,6 +422,7 @@
       PUBLIC
         ${ABSL_CC_TEST_DEFINES}
         ABSL_CONSUME_DLL
+        ABSL_CONSUME_TEST_DLL
         GTEST_LINKED_AS_SHARED_LIBRARY=1
     )
 
diff --git a/absl/base/config.h b/absl/base/config.h
index 5cbc985..c2a973a 100644
--- a/absl/base/config.h
+++ b/absl/base/config.h
@@ -759,6 +759,18 @@
 #define ABSL_DLL
 #endif  // defined(_MSC_VER)
 
+#if defined(_MSC_VER)
+#if defined(ABSL_BUILD_TEST_DLL)
+#define ABSL_TEST_DLL __declspec(dllexport)
+#elif defined(ABSL_CONSUME_TEST_DLL)
+#define ABSL_TEST_DLL __declspec(dllimport)
+#else
+#define ABSL_TEST_DLL
+#endif
+#else
+#define ABSL_TEST_DLL
+#endif  // defined(_MSC_VER)
+
 // ABSL_HAVE_MEMORY_SANITIZER
 //
 // MemorySanitizer (MSan) is a detector of uninitialized reads. It consists of