[PATCH] D137035: [llvm] [cmake] Set EXCLUDE_FROM_ALL on gtest and TestingSupport

Michał Górny via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 29 23:59:31 PDT 2022


mgorny created this revision.
mgorny added reviewers: zturner, bkramer, chandlerc, Bigcheese, MaskRay, tstellar, phosek, serge-sans-paille, labath.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
mgorny requested review of this revision.
Herald added a project: LLVM.

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.


https://reviews.llvm.org/D137035

Files:
  llvm/lib/Testing/Support/CMakeLists.txt
  llvm/utils/unittest/CMakeLists.txt


Index: llvm/utils/unittest/CMakeLists.txt
===================================================================
--- llvm/utils/unittest/CMakeLists.txt
+++ llvm/utils/unittest/CMakeLists.txt
@@ -38,6 +38,10 @@
   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
Index: llvm/lib/Testing/Support/CMakeLists.txt
===================================================================
--- llvm/lib/Testing/Support/CMakeLists.txt
+++ 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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137035.471815.patch
Type: text/x-patch
Size: 900 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221030/177e2ed4/attachment.bin>


More information about the llvm-commits mailing list