Author: Michał Górny Date: 2022-10-24T15:51:43+02:00 New Revision: 52f39853abd46495a6d636c4b035e1b92cf4b833
URL: https://github.com/llvm/llvm-project/commit/52f39853abd46495a6d636c4b035e1b92cf4b833 DIFF: https://github.com/llvm/llvm-project/commit/52f39853abd46495a6d636c4b035e1b92cf4b833.diff LOG: [lldb] Include gtest in standalone build only if LLDB_INCLUDE_TESTS 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. Differential Revision: https://reviews.llvm.org/D136551 Added: Modified: lldb/CMakeLists.txt lldb/cmake/modules/LLDBStandalone.cmake Removed: ################################################################################ diff --git a/lldb/CMakeLists.txt b/lldb/CMakeLists.txt index 88a8f0a651399..12ba8a9d79e20 100644 --- a/lldb/CMakeLists.txt +++ b/lldb/CMakeLists.txt @@ -17,6 +17,8 @@ endif() # 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 @@ 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) if (LLDB_INCLUDE_UNITTESTS) diff --git a/lldb/cmake/modules/LLDBStandalone.cmake b/lldb/cmake/modules/LLDBStandalone.cmake index 98a52969ba30f..1a03c5a5ef749 100644 --- a/lldb/cmake/modules/LLDBStandalone.cmake +++ b/lldb/cmake/modules/LLDBStandalone.cmake @@ -103,16 +103,18 @@ include_directories( "${LLVM_INCLUDE_DIRS}" "${CLANG_INCLUDE_DIRS}") -# 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) _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits