From 44eb8751e080faf45f71c2e99c2affd5d89ceb99 Mon Sep 17 00:00:00 2001
From: Berkus Decker <berkus@madfire.net>
Date: Mon, 4 Dec 2017 02:03:14 +0200
Subject: [PATCH] Move detection to parent cmake file

---
 CMakeLists.txt          | 8 ++++++++
 Telegram/CMakeLists.txt | 9 ---------
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6245dbdc0..f326251be 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -30,6 +30,7 @@ find_package(OpenSSL REQUIRED)
 find_package(FFmpeg REQUIRED)
 find_package(ZLIB REQUIRED)
 find_package(Opus REQUIRED)
+find_package(Qt5 COMPONENTS Core Gui Widgets Network REQUIRED)
 
 if (NOT SWSCALE_FOUND)
     message(FATAL_ERROR "FFmpeg swscale is required")
@@ -38,4 +39,11 @@ if (NOT SWRESAMPLE_FOUND)
     message(FATAL_ERROR "FFmpeg swresample is required")
 endif()
 
+find_program(CCACHE ccache)
+if (CCACHE)
+    message(STATUS "Enabling ccache")
+    set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE})
+    set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE})
+endif()
+
 add_subdirectory(Telegram)
diff --git a/Telegram/CMakeLists.txt b/Telegram/CMakeLists.txt
index 4888aaf37..553f1946d 100644
--- a/Telegram/CMakeLists.txt
+++ b/Telegram/CMakeLists.txt
@@ -1,5 +1,3 @@
-find_package(Qt5 COMPONENTS Core Gui Widgets Network REQUIRED)
-
 # defines
 if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
     if (CMAKE_SIZEOF_VOID_P EQUAL 8)
@@ -9,13 +7,6 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
     endif()
 endif()
 
-find_program(CCACHE ccache)
-if (CCACHE)
-    message(STATUS "Enabling ccache")
-    set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE})
-    set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE})
-endif()
-
 ##======================
 ## Codegen Tools
 ##======================