2023-02-14 18:07:03 +00:00
|
|
|
From 515de0163e1e9653023418c5d5d832d45f98025b Mon Sep 17 00:00:00 2001
|
2018-08-30 23:39:55 +00:00
|
|
|
From: Tom Stellard <tstellar@redhat.com>
|
2023-02-14 18:07:03 +00:00
|
|
|
Date: Tue, 14 Feb 2023 12:10:42 -0300
|
|
|
|
Subject: [PATCH] CMake: Check for gtest headers even if lit.py is not present
|
2018-08-30 23:39:55 +00:00
|
|
|
|
|
|
|
This makes it possible to build the unittests even withotu a full
|
|
|
|
checkout of the llvm source tree.
|
|
|
|
---
|
2021-02-25 14:25:34 +00:00
|
|
|
lld/CMakeLists.txt | 15 +++++++++------
|
2018-08-30 23:39:55 +00:00
|
|
|
1 file changed, 9 insertions(+), 6 deletions(-)
|
|
|
|
|
2021-02-25 14:25:34 +00:00
|
|
|
diff --git a/lld/CMakeLists.txt b/lld/CMakeLists.txt
|
2023-02-14 18:07:03 +00:00
|
|
|
index 3d6225646fe6..f86ac98957c4 100644
|
2021-02-25 14:25:34 +00:00
|
|
|
--- a/lld/CMakeLists.txt
|
|
|
|
+++ b/lld/CMakeLists.txt
|
2023-02-14 18:07:03 +00:00
|
|
|
@@ -66,6 +66,15 @@ if(LLD_BUILT_STANDALONE)
|
2018-08-30 23:39:55 +00:00
|
|
|
set(LLVM_UTILS_PROVIDED ON)
|
|
|
|
endif()
|
|
|
|
|
2023-02-14 18:07:03 +00:00
|
|
|
+ # Check for gtest
|
|
|
|
+ set(UNITTEST_DIR ${LLVM_THIRD_PARTY_DIR}/utils/unittest)
|
2018-08-30 23:39:55 +00:00
|
|
|
+ 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()
|
|
|
|
+
|
2023-02-14 18:07:03 +00:00
|
|
|
+ # Check for lit
|
2018-08-30 23:39:55 +00:00
|
|
|
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)
|
2023-02-14 18:07:03 +00:00
|
|
|
@@ -75,12 +84,6 @@ if(LLD_BUILT_STANDALONE)
|
2018-08-30 23:39:55 +00:00
|
|
|
set(LLVM_UTILS_PROVIDED ON)
|
|
|
|
set(LLD_TEST_DEPS FileCheck not)
|
|
|
|
endif()
|
2023-02-14 18:07:03 +00:00
|
|
|
- set(UNITTEST_DIR ${LLVM_THIRD_PARTY_DIR}/unittest)
|
2018-08-30 23:39:55 +00:00
|
|
|
- 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)
|
2023-02-14 18:07:03 +00:00
|
|
|
- add_subdirectory(${UNITTEST_DIR} third-party/unittest)
|
2018-08-30 23:39:55 +00:00
|
|
|
- endif()
|
|
|
|
else()
|
|
|
|
# Seek installed Lit.
|
|
|
|
find_program(LLVM_LIT
|
|
|
|
--
|
2023-02-14 18:07:03 +00:00
|
|
|
2.39.1
|
2018-08-30 23:39:55 +00:00
|
|
|
|