lld/0001-PATCH-lld-CMake-Check-for-gtest-headers-even-if-lit..patch
Tulio Magno Quites Machado Filho 4071daf523 Update to LLVM 16.0.0 RC1
2023-02-14 15:07:03 -03:00

48 lines
1.8 KiB
Diff

From 515de0163e1e9653023418c5d5d832d45f98025b Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar@redhat.com>
Date: Tue, 14 Feb 2023 12:10:42 -0300
Subject: [PATCH] CMake: Check for gtest headers even if lit.py is not present
This makes it possible to build the unittests even withotu a full
checkout of the llvm source tree.
---
lld/CMakeLists.txt | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/lld/CMakeLists.txt b/lld/CMakeLists.txt
index 3d6225646fe6..f86ac98957c4 100644
--- a/lld/CMakeLists.txt
+++ b/lld/CMakeLists.txt
@@ -66,6 +66,15 @@ if(LLD_BUILT_STANDALONE)
set(LLVM_UTILS_PROVIDED ON)
endif()
+ # Check for gtest
+ set(UNITTEST_DIR ${LLVM_THIRD_PARTY_DIR}/utils/unittest)
+ if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h
+ AND NOT EXISTS ${LLVM_LIBRARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}
+ AND EXISTS ${UNITTEST_DIR}/CMakeLists.txt)
+ add_subdirectory(${UNITTEST_DIR} utils/unittest)
+ endif()
+
+ # Check for lit
if(EXISTS ${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py)
# Note: path not really used, except for checking if lit was found
set(LLVM_LIT ${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py)
@@ -75,12 +84,6 @@ if(LLD_BUILT_STANDALONE)
set(LLVM_UTILS_PROVIDED ON)
set(LLD_TEST_DEPS FileCheck not)
endif()
- set(UNITTEST_DIR ${LLVM_THIRD_PARTY_DIR}/unittest)
- if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h
- AND NOT EXISTS ${LLVM_LIBRARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}
- AND EXISTS ${UNITTEST_DIR}/CMakeLists.txt)
- add_subdirectory(${UNITTEST_DIR} third-party/unittest)
- endif()
else()
# Seek installed Lit.
find_program(LLVM_LIT
--
2.39.1