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

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