[third-party] Respect LLVM_INSTALL_GTEST for llvm_gtest_main
authorMichał Górny <mgorny@gentoo.org>
Mon, 13 Mar 2023 15:37:10 +0000 (16:37 +0100)
committerMichał Górny <mgorny@gentoo.org>
Mon, 13 Mar 2023 16:11:57 +0000 (17:11 +0100)
Pass BUILDTREE_ONLY to llvm_gtest_main only if LLVM_INSTALL_GTEST
is not set.  This fixes 0807986303f5d498cee32d42c242940d00617ad9.
Otherwise, llvm_gtest_main cannot be used
in LLVM_DISTRIBUTION_COMPONENTS, effectively making it impossible
to install llvm_gtest correctly.

Differential Revision: https://reviews.llvm.org/D145946

third-party/unittest/UnitTestMain/CMakeLists.txt

index 7a3ac8a..729ea7e 100644 (file)
@@ -1,3 +1,8 @@
+set(BUILDTREE_ONLY BUILDTREE_ONLY)
+if (LLVM_INSTALL_GTEST)
+  set(BUILDTREE_ONLY "")
+endif ()
+
 add_llvm_library(llvm_gtest_main
   TestMain.cpp
 
@@ -7,6 +12,5 @@ add_llvm_library(llvm_gtest_main
   LINK_COMPONENTS
   Support # Depends on llvm::cl
 
-  # This library is not meant to be in the install tree, only the build tree.
-  BUILDTREE_ONLY
+  ${BUILDTREE_ONLY}
   )