[OpenMP] Check for gtest when building libomptarget unit tests (#76141)

This patch addresses an issue introduced in pull request #74398. CMake
will attempt to re-build gtest if openmp is enabled as a project (as
opposed to being enabled as a runtime). This patch adds a check that
prevents this from happening.

GitOrigin-RevId: cb3a8934365c11ab23c918b44985f5a2f287acb1
diff --git a/libomptarget/CMakeLists.txt b/libomptarget/CMakeLists.txt
index 7060e20..31e475d 100644
--- a/libomptarget/CMakeLists.txt
+++ b/libomptarget/CMakeLists.txt
@@ -153,6 +153,8 @@
 
 # Add unit tests if GMock/GTest is present
 if (EXISTS ${LLVM_THIRD_PARTY_DIR}/unittest)
-  add_subdirectory(${LLVM_THIRD_PARTY_DIR}/unittest ${CMAKE_CURRENT_BINARY_DIR}/third-party/unittest)
+  if (NOT TARGET llvm_gtest)
+    add_subdirectory(${LLVM_THIRD_PARTY_DIR}/unittest ${CMAKE_CURRENT_BINARY_DIR}/third-party/unittest)
+  endif()
   add_subdirectory(unittests)
 endif()