[Lldb-commits] [PATCH] D124314: lldb: Disable unittests if llvm_gtest target does not exist

Tom Stellard via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 10 16:57:01 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG9c6c4d675bd1: lldb: Disable unittests if llvm_gtest target does not exist (authored by tstellar).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124314/new/

https://reviews.llvm.org/D124314

Files:
  lldb/CMakeLists.txt
  lldb/cmake/modules/LLDBStandalone.cmake
  lldb/unittests/CMakeLists.txt


Index: lldb/unittests/CMakeLists.txt
===================================================================
--- lldb/unittests/CMakeLists.txt
+++ lldb/unittests/CMakeLists.txt
@@ -17,20 +17,6 @@
   list(APPEND LLVM_COMPILE_FLAGS -include ${LLDB_GTEST_COMMON_INCLUDE})
 endif ()
 
-if (LLDB_BUILT_STANDALONE)
-  # Build the gtest library needed for unittests, if we have LLVM sources
-  # handy.
-  if (EXISTS ${LLVM_MAIN_SRC_DIR}/utils/unittest AND NOT TARGET llvm_gtest)
-    add_subdirectory(${LLVM_MAIN_SRC_DIR}/utils/unittest utils/unittest)
-  endif()
-  # LLVMTestingSupport library is needed for Process/gdb-remote.
-  if (EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Testing/Support
-      AND NOT TARGET LLVMTestingSupport)
-    add_subdirectory(${LLVM_MAIN_SRC_DIR}/lib/Testing/Support
-      lib/Testing/Support)
-  endif()
-endif()
-
 function(add_lldb_unittest test_name)
   cmake_parse_arguments(ARG
     ""
Index: lldb/cmake/modules/LLDBStandalone.cmake
===================================================================
--- lldb/cmake/modules/LLDBStandalone.cmake
+++ lldb/cmake/modules/LLDBStandalone.cmake
@@ -97,6 +97,18 @@
 set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}")
 set(LLVM_INCLUDE_TESTS ON CACHE INTERNAL "")
 
+# Build the gtest library needed for unittests, if we have LLVM sources
+# handy.
+if (EXISTS ${LLVM_MAIN_SRC_DIR}/utils/unittest AND NOT TARGET llvm_gtest)
+  add_subdirectory(${LLVM_MAIN_SRC_DIR}/utils/unittest utils/unittest)
+endif()
+# LLVMTestingSupport library is needed for Process/gdb-remote.
+if (EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Testing/Support
+    AND NOT TARGET LLVMTestingSupport)
+  add_subdirectory(${LLVM_MAIN_SRC_DIR}/lib/Testing/Support
+    lib/Testing/Support)
+endif()
+
 option(LLVM_USE_FOLDERS "Enable solution folders in Visual Studio. Disable for Express versions." ON)
 if(LLVM_USE_FOLDERS)
   set_property(GLOBAL PROPERTY USE_FOLDERS ON)
Index: lldb/CMakeLists.txt
===================================================================
--- lldb/CMakeLists.txt
+++ lldb/CMakeLists.txt
@@ -124,10 +124,17 @@
   finish_swig_lua("lldb-lua" "${lldb_lua_bindings_dir}" "${lldb_lua_target_dir}")
 endif()
 
+set(LLDB_INCLUDE_UNITTESTS ON)
+if (NOT TARGET llvm_gtest)
+  set(LLDB_INCLUDE_UNITTESTS OFF)
+endif()
+
 option(LLDB_INCLUDE_TESTS "Generate build targets for the LLDB unit tests." ${LLVM_INCLUDE_TESTS})
 if(LLDB_INCLUDE_TESTS)
   add_subdirectory(test)
-  add_subdirectory(unittests)
+  if (LLDB_INCLUDE_UNITTESTS)
+    add_subdirectory(unittests)
+  endif()
   add_subdirectory(utils)
 endif()
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124314.451684.patch
Type: text/x-patch
Size: 2550 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220810/85ad9c41/attachment.bin>


More information about the lldb-commits mailing list