[Openmp-commits] [openmp] cb3a893 - [OpenMP] Check for gtest when building libomptarget unit tests (#76141)

via Openmp-commits openmp-commits at lists.llvm.org
Thu Dec 21 02:00:40 PST 2023


Author: Ethan Luis McDonough
Date: 2023-12-21T04:00:35-06:00
New Revision: cb3a8934365c11ab23c918b44985f5a2f287acb1

URL: https://github.com/llvm/llvm-project/commit/cb3a8934365c11ab23c918b44985f5a2f287acb1
DIFF: https://github.com/llvm/llvm-project/commit/cb3a8934365c11ab23c918b44985f5a2f287acb1.diff

LOG: [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.

Added: 
    

Modified: 
    openmp/libomptarget/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/openmp/libomptarget/CMakeLists.txt b/openmp/libomptarget/CMakeLists.txt
index 7060e20af09324..31e475d86960ae 100644
--- a/openmp/libomptarget/CMakeLists.txt
+++ b/openmp/libomptarget/CMakeLists.txt
@@ -153,6 +153,8 @@ add_subdirectory(test)
 
 # 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()


        


More information about the Openmp-commits mailing list