[llvm] b6be37b - [llvm] [cmake] Set EXCLUDE_FROM_ALL on gtest and TestingSupport
Michał Górny via llvm-commits
llvm-commits at lists.llvm.org
Sun Nov 6 00:55:32 PDT 2022
Author: Michał Górny
Date: 2022-11-06T08:55:20+01:00
New Revision: b6be37b0be5e1b524456c375700c76b7dae5171c
URL: https://github.com/llvm/llvm-project/commit/b6be37b0be5e1b524456c375700c76b7dae5171c
DIFF: https://github.com/llvm/llvm-project/commit/b6be37b0be5e1b524456c375700c76b7dae5171c.diff
LOG: [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
Added:
Modified:
llvm/lib/Testing/Support/CMakeLists.txt
llvm/utils/unittest/CMakeLists.txt
Removed:
################################################################################
diff --git a/llvm/lib/Testing/Support/CMakeLists.txt b/llvm/lib/Testing/Support/CMakeLists.txt
index 81774eb171ca..385d8eca2daa 100644
--- a/llvm/lib/Testing/Support/CMakeLists.txt
+++ b/llvm/lib/Testing/Support/CMakeLists.txt
@@ -1,3 +1,7 @@
+# Do not build unittest libraries automatically, they will be pulled in
+# by unittests if these are built.
+set(EXCLUDE_FROM_ALL ON)
+
add_llvm_library(LLVMTestingSupport
Annotations.cpp
Error.cpp
diff --git a/llvm/utils/unittest/CMakeLists.txt b/llvm/utils/unittest/CMakeLists.txt
index 0e54e0e57c35..302e9e0e8440 100644
--- a/llvm/utils/unittest/CMakeLists.txt
+++ b/llvm/utils/unittest/CMakeLists.txt
@@ -38,6 +38,10 @@ if (HAVE_LIBPTHREAD)
list(APPEND LIBS pthread)
endif()
+# Do not build unittest libraries automatically, they will be pulled in
+# by unittests if these are built.
+set(EXCLUDE_FROM_ALL ON)
+
add_llvm_library(llvm_gtest
googletest/src/gtest-all.cc
googlemock/src/gmock-all.cc
More information about the llvm-commits
mailing list