[Lldb-commits] [lldb] 9c6c4d6 - lldb: Disable unittests if llvm_gtest target does not exist
Tom Stellard via lldb-commits
lldb-commits at lists.llvm.org
Wed Aug 10 16:56:53 PDT 2022
Author: Tom Stellard
Date: 2022-08-10T16:56:08-07:00
New Revision: 9c6c4d675bd1c17cfbfb9aaa18a05e5f0a0ca634
URL: https://github.com/llvm/llvm-project/commit/9c6c4d675bd1c17cfbfb9aaa18a05e5f0a0ca634
DIFF: https://github.com/llvm/llvm-project/commit/9c6c4d675bd1c17cfbfb9aaa18a05e5f0a0ca634.diff
LOG: lldb: Disable unittests if llvm_gtest target does not exist
This fixes the stand-alone build configuration where LLVM_MAIN_SRC_DIR
does not exist.
Reviewed By: JDevlieghere
Differential Revision: https://reviews.llvm.org/D124314
Added:
Modified:
lldb/CMakeLists.txt
lldb/cmake/modules/LLDBStandalone.cmake
lldb/unittests/CMakeLists.txt
Removed:
################################################################################
diff --git a/lldb/CMakeLists.txt b/lldb/CMakeLists.txt
index fff25c344708a..88a8f0a651399 100644
--- a/lldb/CMakeLists.txt
+++ b/lldb/CMakeLists.txt
@@ -124,10 +124,17 @@ if (LLDB_ENABLE_LUA)
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()
diff --git a/lldb/cmake/modules/LLDBStandalone.cmake b/lldb/cmake/modules/LLDBStandalone.cmake
index d2f07576bf216..9cd3f1e8186ba 100644
--- a/lldb/cmake/modules/LLDBStandalone.cmake
+++ b/lldb/cmake/modules/LLDBStandalone.cmake
@@ -97,6 +97,18 @@ include(LLVMDistributionSupport)
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)
diff --git a/lldb/unittests/CMakeLists.txt b/lldb/unittests/CMakeLists.txt
index 79afbbf1f8f54..e29bc8da9e9da 100644
--- a/lldb/unittests/CMakeLists.txt
+++ b/lldb/unittests/CMakeLists.txt
@@ -17,20 +17,6 @@ else ()
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
""
More information about the lldb-commits
mailing list