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

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