From: Anton Gladky <gladk@debian.org>
Date: Mon, 2 Nov 2020 22:39:50 +0100
Subject: Add CMakeLists files for building of shared library and to examples

Last-Update: 2018-01-30
---
 CMakeLists.txt                                     | 30 ++++++++++++++++++++++
 cmake/QCustomPlotConfig.cmake                      | 19 ++++++++++++++
 examples/interactions/CMakeLists.txt               | 20 +++++++++++++++
 examples/plots/CMakeLists.txt                      | 20 +++++++++++++++
 .../scrollbar-axis-range-control/CMakeLists.txt    | 20 +++++++++++++++
 examples/text-document-integration/CMakeLists.txt  | 20 +++++++++++++++
 6 files changed, 129 insertions(+)
 create mode 100644 CMakeLists.txt
 create mode 100644 cmake/QCustomPlotConfig.cmake
 create mode 100644 examples/interactions/CMakeLists.txt
 create mode 100644 examples/plots/CMakeLists.txt
 create mode 100644 examples/scrollbar-axis-range-control/CMakeLists.txt
 create mode 100644 examples/text-document-integration/CMakeLists.txt

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..e8734d2
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,30 @@
+PROJECT(qcustomplot CXX)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+
+SET(Q_MAJOR_VERSION "2")
+SET(Q_MINOR_VERSION "0")
+SET(Q_PATCH_VERSION "1")
+
+INCLUDE(GNUInstallDirs)
+
+find_package(Qt5 COMPONENTS Widgets PrintSupport REQUIRED)
+INCLUDE_DIRECTORIES(${Qt5Widgets_INCLUDE_DIRS} /usr/include/qt5/QtPrintSupport)
+ADD_DEFINITIONS(${Qt5Widgets_DEFINITIONS} -DQCUSTOMPLOT_COMPILE_LIBRARY)
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+set(CMAKE_AUTOUIC ON)
+
+
+set(Q_VERSION "${Q_MAJOR_VERSION}.${Q_MINOR_VERSION}.${Q_PATCH_VERSION}")
+set(Q_SOVERSION "${Q_MAJOR_VERSION}.${Q_MINOR_VERSION}")
+
+ADD_LIBRARY(qcustomplot SHARED qcustomplot.cpp)
+
+SET_TARGET_PROPERTIES(qcustomplot PROPERTIES
+  VERSION ${Q_VERSION}
+  SOVERSION ${Q_SOVERSION})
+TARGET_LINK_LIBRARIES(qcustomplot Qt5::Widgets Qt5::PrintSupport)
+
+INSTALL(TARGETS qcustomplot DESTINATION "${CMAKE_INSTALL_LIBDIR}")
+INSTALL(FILES qcustomplot.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
+INSTALL(FILES cmake/QCustomPlotConfig.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/QCustomPlot)
diff --git a/cmake/QCustomPlotConfig.cmake b/cmake/QCustomPlotConfig.cmake
new file mode 100644
index 0000000..02da472
--- /dev/null
+++ b/cmake/QCustomPlotConfig.cmake
@@ -0,0 +1,19 @@
+# Try to find the QCustomPlot librairies
+#  QCustomPlot_FOUND - system has QCustomPlot lib
+#  QCustomPlot_INCLUDE_DIR - the GMP include directory
+#  QCustomPlot_LIBRARIES - Libraries needed to use QCustomPlot
+
+# Copyright (c) 2013, Anton Gladky <gladk@debian.org>
+#
+# Redistribution and use is allowed according to the terms of the GPL-3 license.
+
+
+IF (QCustomPlot_INCLUDE_DIR AND QCustomPlot_LIBRARIES)
+  SET(QCustomPlot_FIND_QUIETLY TRUE)
+ENDIF (QCustomPlot_INCLUDE_DIR AND QCustomPlot_LIBRARIES)
+
+FIND_PATH(QCustomPlot_INCLUDE_DIR NAMES qcustomplot.h )
+FIND_LIBRARY(QCustomPlot_LIBRARIES NAMES qcustomplot )
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(QCustomPlot DEFAULT_MSG QCustomPlot_INCLUDE_DIR QCustomPlot_LIBRARIES)
diff --git a/examples/interactions/CMakeLists.txt b/examples/interactions/CMakeLists.txt
new file mode 100644
index 0000000..2a64a60
--- /dev/null
+++ b/examples/interactions/CMakeLists.txt
@@ -0,0 +1,20 @@
+project(interactions CXX)
+cmake_minimum_required(VERSION 2.8)
+
+FIND_PACKAGE(QCustomPlot REQUIRED)
+FIND_PACKAGE(Qt5PrintSupport REQUIRED)
+set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cMake")
+
+INCLUDE(GNUInstallDirs)
+FIND_PACKAGE(Qt5Widgets REQUIRED)
+INCLUDE_DIRECTORIES(${Qt5Widgets_INCLUDE_DIRS})
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${QCustomPlot_INCLUDE_DIR})
+ADD_DEFINITIONS(${Qt5Widgets_DEFINITIONS} -DQCUSTOMPLOT_USE_LIBRARY)
+SET(CMAKE_AUTOMOC ON)
+
+QT5_WRAP_UI(UI_HEADERS mainwindow.ui)
+ADD_EXECUTABLE(interactions main.cpp mainwindow.cpp ${UI_HEADERS})
+QT5_USE_MODULES(interactions Widgets)
+
+TARGET_LINK_LIBRARIES(interactions ${Qt5Widgets_LIBRARIES} ${QCustomPlot_LIBRARIES} Qt5::PrintSupport)
+INSTALL(TARGETS interactions DESTINATION ${CMAKE_INSTALL_BINDIR})
diff --git a/examples/plots/CMakeLists.txt b/examples/plots/CMakeLists.txt
new file mode 100644
index 0000000..cb123a6
--- /dev/null
+++ b/examples/plots/CMakeLists.txt
@@ -0,0 +1,20 @@
+project(plots CXX)
+cmake_minimum_required(VERSION 2.8)
+
+FIND_PACKAGE(QCustomPlot REQUIRED)
+FIND_PACKAGE(Qt5PrintSupport REQUIRED)
+set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cMake")
+
+INCLUDE(GNUInstallDirs)
+FIND_PACKAGE(Qt5Widgets REQUIRED)
+INCLUDE_DIRECTORIES(${Qt5Widgets_INCLUDE_DIRS})
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${QCustomPlot_INCLUDE_DIR})
+ADD_DEFINITIONS(${Qt5Widgets_DEFINITIONS} -DQCUSTOMPLOT_USE_LIBRARY)
+SET(CMAKE_AUTOMOC ON)
+
+QT5_WRAP_UI(UI_HEADERS mainwindow.ui)
+ADD_EXECUTABLE(plots main.cpp mainwindow.cpp ${UI_HEADERS})
+QT5_USE_MODULES(plots Widgets)
+
+TARGET_LINK_LIBRARIES(plots ${Qt5Widgets_LIBRARIES} ${QCustomPlot_LIBRARIES} Qt5::PrintSupport)
+INSTALL(TARGETS plots DESTINATION ${CMAKE_INSTALL_BINDIR})
diff --git a/examples/scrollbar-axis-range-control/CMakeLists.txt b/examples/scrollbar-axis-range-control/CMakeLists.txt
new file mode 100644
index 0000000..31e5591
--- /dev/null
+++ b/examples/scrollbar-axis-range-control/CMakeLists.txt
@@ -0,0 +1,20 @@
+project(scrollbar CXX)
+cmake_minimum_required(VERSION 2.8)
+
+FIND_PACKAGE(QCustomPlot REQUIRED)
+FIND_PACKAGE(Qt5PrintSupport REQUIRED)
+set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cMake")
+
+INCLUDE(GNUInstallDirs)
+FIND_PACKAGE(Qt5Widgets REQUIRED)
+INCLUDE_DIRECTORIES(${Qt5Widgets_INCLUDE_DIRS})
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${QCustomPlot_INCLUDE_DIR})
+ADD_DEFINITIONS(${Qt5Widgets_DEFINITIONS} -DQCUSTOMPLOT_USE_LIBRARY)
+SET(CMAKE_AUTOMOC ON)
+
+QT5_WRAP_UI(UI_HEADERS mainwindow.ui)
+ADD_EXECUTABLE(scrollbar main.cpp mainwindow.cpp ${UI_HEADERS})
+QT5_USE_MODULES(scrollbar Widgets)
+
+TARGET_LINK_LIBRARIES(scrollbar ${Qt5Widgets_LIBRARIES} ${QCustomPlot_LIBRARIES} Qt5::PrintSupport)
+INSTALL(TARGETS scrollbar DESTINATION ${CMAKE_INSTALL_BINDIR})
diff --git a/examples/text-document-integration/CMakeLists.txt b/examples/text-document-integration/CMakeLists.txt
new file mode 100644
index 0000000..549d695
--- /dev/null
+++ b/examples/text-document-integration/CMakeLists.txt
@@ -0,0 +1,20 @@
+project(text CXX)
+cmake_minimum_required(VERSION 2.8)
+
+FIND_PACKAGE(QCustomPlot REQUIRED)
+FIND_PACKAGE(Qt5PrintSupport REQUIRED)
+set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cMake")
+
+INCLUDE(GNUInstallDirs)
+FIND_PACKAGE(Qt5Widgets REQUIRED)
+INCLUDE_DIRECTORIES(${Qt5Widgets_INCLUDE_DIRS})
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${QCustomPlot_INCLUDE_DIR})
+ADD_DEFINITIONS(${Qt5Widgets_DEFINITIONS} -DQCUSTOMPLOT_USE_LIBRARY)
+SET(CMAKE_AUTOMOC ON)
+
+QT5_WRAP_UI(UI_HEADERS mainwindow.ui)
+ADD_EXECUTABLE(text main.cpp mainwindow.cpp qcpdocumentobject.cpp ${UI_HEADERS})
+QT5_USE_MODULES(text Widgets)
+
+TARGET_LINK_LIBRARIES(text ${Qt5Widgets_LIBRARIES} ${QCustomPlot_LIBRARIES} Qt5::PrintSupport)
+INSTALL(TARGETS text DESTINATION ${CMAKE_INSTALL_BINDIR})
