From 1bd3700c2333b86e5374c1bb753270b50e0ecc2c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcus=20M=C3=BCller?= <marcus@hostalia.de>
Date: Wed, 14 Sep 2016 16:48:16 -0600
Subject: [PATCH 15/22] fixed the FindQwt to prefer pkgconfig for qt5-qwt

---
 cmake/Modules/FindQwt.cmake | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/cmake/Modules/FindQwt.cmake b/cmake/Modules/FindQwt.cmake
index 2cffbe66f4..971578fd23 100644
--- a/cmake/Modules/FindQwt.cmake
+++ b/cmake/Modules/FindQwt.cmake
@@ -5,6 +5,14 @@
 # qwt_global.h holds a string with the QWT version;
 #   test to make sure it's at least 5.2
 
+if (${DESIRED_QT_VERSION} MATCHES 5)
+  set(QWT_QT_VERSION qt5)
+  message(STATUS "Looking for Qt5Qwt6")
+  pkg_check_modules(QWT Qt5Qwt6)
+  message(STATUS "found ${QWT_FOUND}")
+else()
+  set(QWT_QT_VERSION qt4)
+
 find_path(QWT_INCLUDE_DIRS
   NAMES qwt_global.h
   HINTS
@@ -36,9 +44,15 @@ find_library (QWT_LIBRARIES
   /usr/local/lib/qwt.framework
 )
 
+endif()
 set(QWT_FOUND FALSE)
 if(QWT_INCLUDE_DIRS)
-  file(STRINGS "${QWT_INCLUDE_DIRS}/qwt_global.h"
+  find_path(QWT_GLOBAL_DIR
+    NAMES qwt_global.h
+    HINTS
+    ${QWT_INCLUDE_DIRS}
+    )
+  file(STRINGS "${QWT_GLOBAL_DIR}/qwt_global.h"
     QWT_STRING_VERSION REGEX "QWT_VERSION_STR")
   set(QWT_WRONG_VERSION True)
   set(QWT_VERSION "No Version")
-- 
2.11.0

