File shared-gtest.patch of Package aseprite

From 2d04a4b6845207329a92d0d32c4702e4ec163127 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= <rverschelde@gmail.com>
Date: Wed, 28 Sep 2016 21:48:10 +0200
Subject: [PATCH] Libs: Allow building against shared gtest

---
 CMakeLists.txt             |  6 ++++++
 third_party/CMakeLists.txt | 16 +++++++++-------
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index ed77f00..928c658 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -55,6 +55,7 @@ option(WITH_QT_THUMBNAILER          "Enable kde5/qt5 thumnailer" off)
 option(USE_STATIC_LIBC    "Use static version of C and C++ runtimes" off)
 option(USE_SHARED_CURL    "Use your installed copy of curl" off)
 option(USE_SHARED_GIFLIB  "Use your installed copy of giflib" off)
+option(USE_SHARED_GTEST   "Use your installed copy of gtest" off)
 option(USE_SHARED_JPEGLIB "Use your installed copy of jpeglib" off)
 option(USE_SHARED_ZLIB    "Use your installed copy of zlib" off)
 option(USE_SHARED_LIBPNG  "Use your installed copy of libpng" off)
@@ -255,6 +256,11 @@ else()
 endif()
 include_directories(${GIF_INCLUDE_DIRS})
 
+if(USE_SHARED_GTEST)
+  find_package(GTest REQUIRED)
+endif()
+include_directories(${GTEST_INCLUDE_DIRS})
+
 if(USE_SHARED_JPEGLIB)
   find_package(JPEG REQUIRED)
 else()
diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt
index dc6c5cc..db71983 100644
--- a/third_party/CMakeLists.txt
+++ b/third_party/CMakeLists.txt
@@ -43,13 +43,15 @@ if(NOT USE_SHARED_TINYXML)
   add_subdirectory(tinyxml)
 endif()
 
-if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/gtest/CMakeLists.txt)
-  # We don't use add_subdirectory(gtest) because the gtest
-  # CMakeLists.txt modifies some MSVC flags.
-  include_directories(${CMAKE_CURRENT_SOURCE_DIR}/gtest ${CMAKE_CURRENT_SOURCE_DIR}/gtest/include)
-  add_library(gtest ${CMAKE_CURRENT_SOURCE_DIR}/gtest/src/gtest-all.cc)
-else()
-  message(FATAL_ERROR "gtest/gtest.h is missing. Initialize submodules: git submodule update --init --recursive")
+if(NOT USE_SHARED_GTEST)
+  if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/gtest/CMakeLists.txt)
+    # We don't use add_subdirectory(gtest) because the gtest
+    # CMakeLists.txt modifies some MSVC flags.
+    include_directories(${CMAKE_CURRENT_SOURCE_DIR}/gtest ${CMAKE_CURRENT_SOURCE_DIR}/gtest/include)
+    add_library(gtest ${CMAKE_CURRENT_SOURCE_DIR}/gtest/src/gtest-all.cc)
+  else()
+    message(FATAL_ERROR "gtest/gtest.h is missing. Initialize submodules: git submodule update --init --recursive")
+  endif()
 endif()
 
 if(NOT USE_SHARED_CURL)
openSUSE Build Service is sponsored by