-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
73 lines (65 loc) · 2.23 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# cmake file for https://www.qcustomplot.com/
cmake_minimum_required(VERSION 3.16...3.31)
project(
QCustomPlot
VERSION 2.1.1
DESCRIPTION "QCustomPlot"
LANGUAGES CXX)
# workaround for https://gitlab.kitware.com/cmake/cmake/-/issues/25974
set(CMAKE_CXX_SCAN_FOR_MODULES OFF)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
add_library(qcustomplot STATIC qcustomplot.cpp)
add_library(qcustomplot::qcustomplot ALIAS qcustomplot)
set_target_properties(qcustomplot PROPERTIES CXX_STANDARD 20)
set_target_properties(qcustomplot PROPERTIES POSITION_INDEPENDENT_CODE ON)
set(WITH_QT6
on
CACHE BOOL "Use Qt6")
if(WITH_QT6)
find_package(
Qt6
COMPONENTS Widgets PrintSupport
REQUIRED)
else()
find_package(
Qt5
COMPONENTS Widgets PrintSupport
REQUIRED)
endif()
target_link_libraries(qcustomplot PRIVATE Qt::Widgets Qt::PrintSupport)
include(GNUInstallDirs)
set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/qcustomplot)
install(
TARGETS qcustomplot
EXPORT qcustomplot-targets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(FILES qcustomplot.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
target_include_directories(
qcustomplot PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>)
set_target_properties(qcustomplot PROPERTIES EXPORT_NAME qcustomplot)
install(
EXPORT qcustomplot-targets
FILE qcustomplotTargets.cmake
NAMESPACE qcustomplot::
DESTINATION ${INSTALL_CONFIGDIR})
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/qcustomplotConfigVersion.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion)
configure_package_config_file(
${CMAKE_CURRENT_LIST_DIR}/cmake/qcustomplotConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/qcustomplotConfig.cmake
INSTALL_DESTINATION ${INSTALL_CONFIGDIR})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/qcustomplotConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/qcustomplotConfigVersion.cmake
DESTINATION ${INSTALL_CONFIGDIR})
export(
EXPORT qcustomplot-targets
FILE ${CMAKE_CURRENT_BINARY_DIR}/qcustomplotTargets.cmake
NAMESPACE qcustomplot::)
export(PACKAGE qcustomplot)