[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
Fri Apr 22 17:59:17 PDT 2022
tstellar created this revision.
Herald added a subscriber: mgorny.
Herald added a project: All.
tstellar requested review of this revision.
Herald added a project: LLDB.
This fixes the stand-alone build configuration where LLVM_MAIN_SRC_DIR
does not exist.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D124314
Files:
lldb/CMakeLists.txt
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/CMakeLists.txt
===================================================================
--- lldb/CMakeLists.txt
+++ lldb/CMakeLists.txt
@@ -124,10 +124,31 @@
finish_swig_lua("lldb-lua" "${lldb_lua_bindings_dir}" "${lldb_lua_target_dir}")
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()
+
+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.424674.patch
Type: text/x-patch
Size: 2118 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220423/70fe788b/attachment.bin>
More information about the lldb-commits
mailing list