Blame SOURCES/0001-PATCH-lld-CMake-Check-for-gtest-headers-even-if-lit..patch

3ec930
From 760568cd24acd6ae9083b0dfea2c7c0ea6f0adc2 Mon Sep 17 00:00:00 2001
3ec930
From: Tom Stellard <tstellar@redhat.com>
3ec930
Date: Thu, 30 Aug 2018 08:53:56 -0700
3ec930
Subject: [PATCH 1/2] [PATCH][lld] CMake: Check for gtest headers even if
3ec930
 lit.py is not present
3ec930
3ec930
This makes it possible to build the unittests even withotu a full
3ec930
checkout of the llvm source tree.
3ec930
---
3ec930
 lld/CMakeLists.txt | 15 +++++++++------
3ec930
 1 file changed, 9 insertions(+), 6 deletions(-)
3ec930
3ec930
diff --git a/lld/CMakeLists.txt b/lld/CMakeLists.txt
3ec930
index d4e561b..a7406d1c 100644
3ec930
--- a/lld/CMakeLists.txt
3ec930
+++ b/lld/CMakeLists.txt
3ec930
@@ -65,6 +65,15 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
3ec930
       set(LLVM_UTILS_PROVIDED ON)
3ec930
     endif()
3ec930
 
3ec930
+		# Check for gtest
3ec930
+    set(UNITTEST_DIR ${LLVM_MAIN_SRC_DIR}/utils/unittest)
3ec930
+    if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h
3ec930
+        AND NOT EXISTS ${LLVM_LIBRARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}
3ec930
+        AND EXISTS ${UNITTEST_DIR}/CMakeLists.txt)
3ec930
+      add_subdirectory(${UNITTEST_DIR} utils/unittest)
3ec930
+    endif()
3ec930
+
3ec930
+		# Check for lit
3ec930
     if(EXISTS ${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py)
3ec930
       # Note: path not really used, except for checking if lit was found
3ec930
       set(LLVM_LIT ${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py)
3ec930
@@ -74,12 +83,6 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
3ec930
         set(LLVM_UTILS_PROVIDED ON)
3ec930
         set(LLD_TEST_DEPS FileCheck not)
3ec930
       endif()
3ec930
-      set(UNITTEST_DIR ${LLVM_MAIN_SRC_DIR}/utils/unittest)
3ec930
-      if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h
3ec930
-          AND NOT EXISTS ${LLVM_LIBRARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}
3ec930
-          AND EXISTS ${UNITTEST_DIR}/CMakeLists.txt)
3ec930
-        add_subdirectory(${UNITTEST_DIR} utils/unittest)
3ec930
-      endif()
3ec930
     else()
3ec930
       # Seek installed Lit.
3ec930
       find_program(LLVM_LIT
3ec930
-- 
3ec930
1.8.3.1
3ec930