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

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