Blame SOURCES/0001-CMake-Check-for-gtest-headers-even-if-lit.py-is-not-.patch

074ff8
From e5bdf4580677da063abe8d3880fbab9eaa7a7efe Mon Sep 17 00:00:00 2001
074ff8
From: Tom Stellard <tstellar@redhat.com>
074ff8
Date: Thu, 30 Aug 2018 08:53:56 -0700
074ff8
Subject: [PATCH] CMake: Check for gtest headers even if 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
---
074ff8
 CMakeLists.txt | 15 +++++++++------
074ff8
 1 file changed, 9 insertions(+), 6 deletions(-)
074ff8
074ff8
diff --git a/CMakeLists.txt b/CMakeLists.txt
074ff8
index e2fbdbf..c9b2927 100644
074ff8
--- a/CMakeLists.txt
074ff8
+++ b/CMakeLists.txt
074ff8
@@ -75,6 +75,15 @@ Please install Python or specify the PYTHON_EXECUTABLE CMake variable.")
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)
074ff8
@@ -84,12 +93,6 @@ Please install Python or specify the PYTHON_EXECUTABLE CMake variable.")
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