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

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