File 0001-Fix-CMake-FindQCustomPlot.patch of Package libxtrx
From 9c2fd206367616b22ab6442aedd2af217e51fd84 Mon Sep 17 00:00:00 2001
From: Martin Hauke <mardnh@gmx.de>
Date: Thu, 10 Dec 2020 17:54:01 +0100
Subject: [PATCH] Fix CMake FindQCustomPlot
---
CMakeLists.txt | 2 +-
cmake/FindQCustomPlot.cmake | 31 +++++++++++++++++++++++++
examples/xtrx_fft/CMakeLists.txt | 4 ++--
examples/xtrx_fft/FindQCustomPlot.cmake | 31 +++++++++++++++++++++++++
4 files changed, 65 insertions(+), 3 deletions(-)
create mode 100644 cmake/FindQCustomPlot.cmake
create mode 100644 examples/xtrx_fft/FindQCustomPlot.cmake
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4615124..c8ec2d6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -103,7 +103,7 @@ target_link_libraries(test_xtrx xtrx ${SYSTEM_LIBS})
find_package(Qt5Widgets)
find_package(Qt5PrintSupport)
find_package(QCustomPlot)
-if(Qt5Widgets_FOUND AND Qt5PrintSupport_FOUND AND QCustomPlot_FOUND)
+if(Qt5Widgets_FOUND AND Qt5PrintSupport_FOUND AND QCUSTOMPLOT_FOUND)
set(LIBXTRX_FOUND TRUE "libxtrx found")
set(LIBXTRX_LIBRARIES xtrx)
set(LIBXTRX_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR})
diff --git a/cmake/FindQCustomPlot.cmake b/cmake/FindQCustomPlot.cmake
new file mode 100644
index 0000000..385cb1e
--- /dev/null
+++ b/cmake/FindQCustomPlot.cmake
@@ -0,0 +1,31 @@
+if(NOT QCUSTOMPLOT_FOUND)
+ if(NOT WIN32)
+ include(FindPkgConfig)
+ pkg_check_modules (QCUSTOMPLOT_PKG qcustomplot)
+ endif(NOT WIN32)
+
+ find_path(QCUSTOMPLOT_INCLUDE_DIRS NAMES qcustomplot.h
+ PATHS
+ ${QCUSTOMPLOT_PKG_INCLUDE_DIRS}
+ /usr/include
+ /usr/local/include
+ )
+
+ find_library(QCUSTOMPLOT_LIBRARIES NAMES qcustomplot
+ PATHS
+ ${QCUSTOMPLOT_PKG_LIBRARY_DIRS}
+ /usr/lib
+ /usr/local/lib
+ )
+
+ if(QCUSTOMPLOT_INCLUDE_DIRS AND QCUSTOMPLOT_LIBRARIES)
+ set(QCUSTOMPLOT_FOUND TRUE CACHE INTERNAL "QCustomPlot found")
+ message(STATUS "Found QCustomPlot: ${QCUSTOMPLOT_INCLUDE_DIRS}, ${QCUSTOMPLOT_LIBRARIES}")
+ else(QCUSTOMPLOT_INCLUDE_DIRS AND QCUSTOMPLOT_LIBRARIES)
+ set(QCUSTOMPLOT_FOUND FALSE CACHE INTERNAL "QCustomPlot found")
+ message(STATUS "QCustomPlot not found.")
+ endif(QCUSTOMPLOT_INCLUDE_DIRS AND QCUSTOMPLOT_LIBRARIES)
+
+ mark_as_advanced(QCUSTOMPLOT_LIBRARIES QCUSTOMPLOT_INCLUDE_DIRS)
+endif(NOT QCUSTOMPLOT_FOUND)
+
diff --git a/examples/xtrx_fft/CMakeLists.txt b/examples/xtrx_fft/CMakeLists.txt
index 2d1662a..2cd1ca5 100644
--- a/examples/xtrx_fft/CMakeLists.txt
+++ b/examples/xtrx_fft/CMakeLists.txt
@@ -12,7 +12,7 @@ message(${CMAKE_MODULE_PATH})
# Find the QtWidgets library
find_package(Qt5Widgets CONFIG REQUIRED)
find_package(Qt5PrintSupport CONFIG REQUIRED)
-find_package(QCustomPlot CONFIG REQUIRED)
+find_package(QCustomPlot REQUIRED)
find_package(LibXTRX REQUIRED)
# Populate a CMake variable with the sources
@@ -27,5 +27,5 @@ set(mainwindow_SRCS
include_directories(${LIBXTRX_INCLUDE_DIRS})
add_executable(xtrx_fft ${mainwindow_SRCS})
-target_link_libraries(xtrx_fft Qt5::Widgets Qt5::PrintSupport ${QCustomPlot_LIBRARIES} ${LIBXTRX_LIBRARIES})
+target_link_libraries(xtrx_fft Qt5::Widgets Qt5::PrintSupport ${QCUSTOMPLOT_LIBRARIES} ${LIBXTRX_LIBRARIES})
install(TARGETS xtrx_fft DESTINATION ${XTRX_UTILS_DIR})
diff --git a/examples/xtrx_fft/FindQCustomPlot.cmake b/examples/xtrx_fft/FindQCustomPlot.cmake
new file mode 100644
index 0000000..385cb1e
--- /dev/null
+++ b/examples/xtrx_fft/FindQCustomPlot.cmake
@@ -0,0 +1,31 @@
+if(NOT QCUSTOMPLOT_FOUND)
+ if(NOT WIN32)
+ include(FindPkgConfig)
+ pkg_check_modules (QCUSTOMPLOT_PKG qcustomplot)
+ endif(NOT WIN32)
+
+ find_path(QCUSTOMPLOT_INCLUDE_DIRS NAMES qcustomplot.h
+ PATHS
+ ${QCUSTOMPLOT_PKG_INCLUDE_DIRS}
+ /usr/include
+ /usr/local/include
+ )
+
+ find_library(QCUSTOMPLOT_LIBRARIES NAMES qcustomplot
+ PATHS
+ ${QCUSTOMPLOT_PKG_LIBRARY_DIRS}
+ /usr/lib
+ /usr/local/lib
+ )
+
+ if(QCUSTOMPLOT_INCLUDE_DIRS AND QCUSTOMPLOT_LIBRARIES)
+ set(QCUSTOMPLOT_FOUND TRUE CACHE INTERNAL "QCustomPlot found")
+ message(STATUS "Found QCustomPlot: ${QCUSTOMPLOT_INCLUDE_DIRS}, ${QCUSTOMPLOT_LIBRARIES}")
+ else(QCUSTOMPLOT_INCLUDE_DIRS AND QCUSTOMPLOT_LIBRARIES)
+ set(QCUSTOMPLOT_FOUND FALSE CACHE INTERNAL "QCustomPlot found")
+ message(STATUS "QCustomPlot not found.")
+ endif(QCUSTOMPLOT_INCLUDE_DIRS AND QCUSTOMPLOT_LIBRARIES)
+
+ mark_as_advanced(QCUSTOMPLOT_LIBRARIES QCUSTOMPLOT_INCLUDE_DIRS)
+endif(NOT QCUSTOMPLOT_FOUND)
+
--
2.26.2