[clang] e99ccd8 - Revert "Add install targets for gtest"

Tom Stellard via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 10 20:01:03 PST 2023


Author: Tom Stellard
Date: 2023-03-10T19:59:20-08:00
New Revision: e99ccd8d03c44c17f797c046c2483e68ea7a2715

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

LOG: Revert "Add install targets for gtest"

This reverts commit cb38df4c4d3aee53107219a68749dc94fe70ff68.

I accidentally committed this with the wrong commit message.

Added: 
    

Modified: 
    clang/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index 1fff005d6525..be59c199f05f 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -118,10 +118,12 @@ if(CLANG_BUILT_STANDALONE)
         set(LLVM_UTILS_PROVIDED ON)
         set(CLANG_TEST_DEPS FileCheck count not)
       endif()
-    endif()
-
-    if (NOT TARGET llvm_gtest)
-        message(FATAL_ERROR "llvm-gtest not found. Please install llvm-gtest or disable tests with -DLLVM_INCLUDE_TESTS=OFF")
+      set(UNITTEST_DIR ${LLVM_THIRD_PARTY_DIR}/unittest)
+      if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h
+          AND NOT EXISTS ${LLVM_LIBRARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}
+          AND EXISTS ${UNITTEST_DIR}/CMakeLists.txt)
+        add_subdirectory(${UNITTEST_DIR} third-party/unittest)
+      endif()
     endif()
 
     if(LLVM_LIT)
@@ -504,11 +506,13 @@ endif()
 
 
 if( CLANG_INCLUDE_TESTS )
-  add_subdirectory(unittests)
-  list(APPEND CLANG_TEST_DEPS ClangUnitTests)
-  list(APPEND CLANG_TEST_PARAMS
-    clang_unit_site_config=${CMAKE_CURRENT_BINARY_DIR}/test/Unit/lit.site.cfg
-  )
+  if(EXISTS ${LLVM_THIRD_PARTY_DIR}/unittest/googletest/include/gtest/gtest.h)
+    add_subdirectory(unittests)
+    list(APPEND CLANG_TEST_DEPS ClangUnitTests)
+    list(APPEND CLANG_TEST_PARAMS
+      clang_unit_site_config=${CMAKE_CURRENT_BINARY_DIR}/test/Unit/lit.site.cfg
+      )
+  endif()
   add_subdirectory(test)
   add_subdirectory(bindings/python/tests)
 


        


More information about the cfe-commits mailing list