Skip to content

Commit 52f3985

Browse files
committed
[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
1 parent e28e214 commit 52f3985

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

lldb/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ endif()
1717
# Must go below project(..)
1818
include(GNUInstallDirs)
1919

20+
option(LLDB_INCLUDE_TESTS "Generate build targets for the LLDB unit tests." ${LLVM_INCLUDE_TESTS})
21+
2022
if(LLDB_BUILT_STANDALONE)
2123
include(LLDBStandalone)
2224

@@ -129,7 +131,6 @@ if (NOT TARGET llvm_gtest)
129131
set(LLDB_INCLUDE_UNITTESTS OFF)
130132
endif()
131133

132-
option(LLDB_INCLUDE_TESTS "Generate build targets for the LLDB unit tests." ${LLVM_INCLUDE_TESTS})
133134
if(LLDB_INCLUDE_TESTS)
134135
add_subdirectory(test)
135136
if (LLDB_INCLUDE_UNITTESTS)

lldb/cmake/modules/LLDBStandalone.cmake

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -103,16 +103,18 @@ include_directories(
103103
"${LLVM_INCLUDE_DIRS}"
104104
"${CLANG_INCLUDE_DIRS}")
105105

106-
# Build the gtest library needed for unittests, if we have LLVM sources
107-
# handy.
108-
if (EXISTS ${LLVM_MAIN_SRC_DIR}/utils/unittest AND NOT TARGET llvm_gtest)
109-
add_subdirectory(${LLVM_MAIN_SRC_DIR}/utils/unittest utils/unittest)
110-
endif()
111-
# LLVMTestingSupport library is needed for Process/gdb-remote.
112-
if (EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Testing/Support
113-
AND NOT TARGET LLVMTestingSupport)
114-
add_subdirectory(${LLVM_MAIN_SRC_DIR}/lib/Testing/Support
115-
lib/Testing/Support)
106+
if(LLDB_INCLUDE_TESTS)
107+
# Build the gtest library needed for unittests, if we have LLVM sources
108+
# handy.
109+
if (EXISTS ${LLVM_MAIN_SRC_DIR}/utils/unittest AND NOT TARGET llvm_gtest)
110+
add_subdirectory(${LLVM_MAIN_SRC_DIR}/utils/unittest utils/unittest)
111+
endif()
112+
# LLVMTestingSupport library is needed for Process/gdb-remote.
113+
if (EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Testing/Support
114+
AND NOT TARGET LLVMTestingSupport)
115+
add_subdirectory(${LLVM_MAIN_SRC_DIR}/lib/Testing/Support
116+
lib/Testing/Support)
117+
endif()
116118
endif()
117119

118120
option(LLVM_USE_FOLDERS "Enable solution folders in Visual Studio. Disable for Express versions." ON)

0 commit comments

Comments
 (0)