mgorny created this revision.
mgorny added reviewers: labath, JDevlieghere, tstellar, MaskRay.
Herald added a subscriber: StephenFan.
Herald added a project: All.
mgorny requested review of this revision.

Build gtest targets when building standalone only if LLDB_INCLUDE_TESTS
is true.  Prior to this change, they were built whenever
LLVM_MAIN_SRC_DIR was available, independently whether tests themselves
would be run.


https://reviews.llvm.org/D136551

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


Index: lldb/cmake/modules/LLDBStandalone.cmake
===================================================================
--- lldb/cmake/modules/LLDBStandalone.cmake
+++ lldb/cmake/modules/LLDBStandalone.cmake
@@ -97,16 +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)
+if(LLDB_INCLUDE_TESTS)
+  # 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()
 
 option(LLVM_USE_FOLDERS "Enable solution folders in Visual Studio. Disable for 
Express versions." ON)
Index: lldb/CMakeLists.txt
===================================================================
--- lldb/CMakeLists.txt
+++ lldb/CMakeLists.txt
@@ -17,6 +17,8 @@
 # Must go below project(..)
 include(GNUInstallDirs)
 
+option(LLDB_INCLUDE_TESTS "Generate build targets for the LLDB unit tests." 
${LLVM_INCLUDE_TESTS})
+
 if(LLDB_BUILT_STANDALONE)
   include(LLDBStandalone)
 
@@ -129,7 +131,6 @@
   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)
   if (LLDB_INCLUDE_UNITTESTS)


Index: lldb/cmake/modules/LLDBStandalone.cmake
===================================================================
--- lldb/cmake/modules/LLDBStandalone.cmake
+++ lldb/cmake/modules/LLDBStandalone.cmake
@@ -97,16 +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)
+if(LLDB_INCLUDE_TESTS)
+  # 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()
 
 option(LLVM_USE_FOLDERS "Enable solution folders in Visual Studio. Disable for Express versions." ON)
Index: lldb/CMakeLists.txt
===================================================================
--- lldb/CMakeLists.txt
+++ lldb/CMakeLists.txt
@@ -17,6 +17,8 @@
 # Must go below project(..)
 include(GNUInstallDirs)
 
+option(LLDB_INCLUDE_TESTS "Generate build targets for the LLDB unit tests." ${LLVM_INCLUDE_TESTS})
+
 if(LLDB_BUILT_STANDALONE)
   include(LLDBStandalone)
 
@@ -129,7 +131,6 @@
   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)
   if (LLDB_INCLUDE_UNITTESTS)
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to