2021-06-23 19:29:35 +00:00
|
|
|
From 760568cd24acd6ae9083b0dfea2c7c0ea6f0adc2 Mon Sep 17 00:00:00 2001
|
2020-08-27 18:57:02 +00:00
|
|
|
From: Tom Stellard <tstellar@redhat.com>
|
|
|
|
Date: Thu, 30 Aug 2018 08:53:56 -0700
|
2021-06-23 19:29:35 +00:00
|
|
|
Subject: [PATCH 1/2] [PATCH][lld] CMake: Check for gtest headers even if
|
|
|
|
lit.py is not present
|
2020-08-27 18:57:02 +00:00
|
|
|
|
|
|
|
This makes it possible to build the unittests even withotu a full
|
|
|
|
checkout of the llvm source tree.
|
|
|
|
---
|
2021-06-23 19:29:35 +00:00
|
|
|
lld/CMakeLists.txt | 15 +++++++++------
|
2020-08-27 18:57:02 +00:00
|
|
|
1 file changed, 9 insertions(+), 6 deletions(-)
|
|
|
|
|
2021-06-23 19:29:35 +00:00
|
|
|
diff --git a/lld/CMakeLists.txt b/lld/CMakeLists.txt
|
|
|
|
index d4e561b..a7406d1c 100644
|
|
|
|
--- a/lld/CMakeLists.txt
|
|
|
|
+++ b/lld/CMakeLists.txt
|
2022-11-15 04:32:02 +00:00
|
|
|
@@ -68,6 +68,16 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
2020-08-27 18:57:02 +00:00
|
|
|
set(LLVM_UTILS_PROVIDED ON)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
+ # Check for gtest
|
|
|
|
+ set(UNITTEST_DIR ${LLVM_MAIN_SRC_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)
|
2022-11-15 04:32:02 +00:00
|
|
|
+ set(HAVE_LIBPTHREAD ON)
|
2020-08-27 18:57:02 +00:00
|
|
|
+ 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)
|
2021-11-19 04:57:11 +00:00
|
|
|
@@ -77,12 +86,6 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
2020-08-27 18:57:02 +00:00
|
|
|
set(LLVM_UTILS_PROVIDED ON)
|
|
|
|
set(LLD_TEST_DEPS FileCheck not)
|
|
|
|
endif()
|
|
|
|
- set(UNITTEST_DIR ${LLVM_MAIN_SRC_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()
|
|
|
|
else()
|
|
|
|
# Seek installed Lit.
|
|
|
|
find_program(LLVM_LIT
|
|
|
|
--
|
|
|
|
1.8.3.1
|
|
|
|
|