Skip to content

Commit b6be37b

Browse files
committed
[llvm] [cmake] Set EXCLUDE_FROM_ALL on gtest and TestingSupport
Exclude building googletest and LLVMTestingSupport libraries from the `all` target. If unittests are being built, these libraries will be built as a dependency anyway. If they are not being built, building them makes little sense as they are not installed or used otherwise. This will also make standalone builds of other projects easier, as it makes it possible to include these directories without having to cover them with additional conditions to prevent them from being built unconditionally. Differential Revision: https://reviews.llvm.org/D137035
1 parent a8d9378 commit b6be37b

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

llvm/lib/Testing/Support/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Do not build unittest libraries automatically, they will be pulled in
2+
# by unittests if these are built.
3+
set(EXCLUDE_FROM_ALL ON)
4+
15
add_llvm_library(LLVMTestingSupport
26
Annotations.cpp
37
Error.cpp

llvm/utils/unittest/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ if (HAVE_LIBPTHREAD)
3838
list(APPEND LIBS pthread)
3939
endif()
4040

41+
# Do not build unittest libraries automatically, they will be pulled in
42+
# by unittests if these are built.
43+
set(EXCLUDE_FROM_ALL ON)
44+
4145
add_llvm_library(llvm_gtest
4246
googletest/src/gtest-all.cc
4347
googlemock/src/gmock-all.cc

0 commit comments

Comments
 (0)