-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
142 lines (117 loc) · 3.68 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# INDIWebManagerApp
# Copyright (C) 2019 Robert Lancaster <[email protected]>
#
# This application is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
######################
project(INDIWebManagerApp)
# Timestamp build
string(TIMESTAMP INDI_WEB_MANAGER_APP_BUILD_TS UTC)
# INDI Web Manager App Version 1.8
set (INDIWebManagerApp_VERSION_MAJOR 1)
set (INDIWebManagerApp_VERSION_MINOR 8)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/src/version.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/version.h
)
cmake_minimum_required (VERSION 2.8.12)
set (CMAKE_CXX_STANDARD 11)
# Fetch translations with -DFETCH_TRANSLATIONS=ON
option(FETCH_TRANSLATIONS "Fetch Translations" OFF)
# Set options for fetching translations
if (FETCH_TRANSLATIONS)
SET(KDE_L10N_AUTO_TRANSLATIONS ON)
SET(KDE_L10N_BRANCH "trunk")
endif()
# This is where the source files are located, including headers
include_directories ("${PROJECT_SOURCE_DIR}/src")
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
#This should eliminate the CMP0071 warning
if(POLICY CMP0071)
cmake_policy(SET CMP0071 NEW)
endif()
# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
find_package(ECM 1.7.0 REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" ${CMAKE_MODULE_PATH})
# Option to choose between Qt5 and Qt6
option(USE_QT5 "Use Qt5" ON)
if(USE_QT5)
find_package(Qt5 5.15 REQUIRED COMPONENTS Widgets Network)
find_package(KF5 REQUIRED COMPONENTS
Config
KIO
DocTools
I18n
)
else(USE_QT5)
find_package(Qt6 REQUIRED COMPONENTS Widgets Network)
find_package(KF6 REQUIRED COMPONENTS
Config
ConfigWidgets
KIO
DocTools
I18n
)
endif(USE_QT5)
# Are all of these needed?
include(ExternalProject)
include(ECMInstallIcons)
include(ECMAddAppIcon)
include(KDEInstallDirs)
include(MacroBoolTo01)
include(ECMQtDeclareLoggingCategory)
include(KDECompilerSettings NO_POLICY_SCOPE)
include(KDECMakeSettings)
include(FeatureSummary)
set (INDIWebManagerApp_SRCS
src/main.cpp
src/mainwindow.cpp
src/opsconfiguration.cpp
src/opsmanager.cpp
)
set (INDIWebManagerAppui_SRCS
src/mainwindow.ui
src/opsconfiguration.ui
src/opsmanager.ui
)
ki18n_wrap_ui(INDIWebManagerApp_SRCS ${INDIWebManagerAppui_SRCS})
If(APPLE)
set(MACOSX_BUNDLE_ICON_FILE INDIWebManagerApp.icns)
set(INDIWebManagerApp_ICON icons/INDIWebManagerApp.icns)
set_source_files_properties(${INDIWebManagerApp_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
endif(APPLE)
ecm_add_app_icon(INDIWebManagerApp_SRCS ICONS
${CMAKE_CURRENT_SOURCE_DIR}/icons/128-indi_logo.png
)
qt_add_resources(INDIWebManagerApp_SRCS resources.qrc)
kconfig_add_kcfg_files(INDIWebManagerApp_SRCS Options.kcfgc)
add_executable(INDIWebManagerApp ${INDIWebManagerApp_ICON} ${INDIWebManagerApp_SRCS})
target_link_libraries(INDIWebManagerApp
Qt::Network
Qt::Widgets
)
if(USE_QT5)
target_link_libraries(INDIWebManagerApp
KF5::I18n
KF5::ConfigCore
KF5::ConfigGui
KF5::KIOFileWidgets
)
else(USE_QT5)
target_link_libraries(INDIWebManagerApp
KF6::I18n
KF6::ConfigWidgets
KF6::ConfigCore
KF6::ConfigGui
KF6::KIOFileWidgets
)
endif(USE_QT5)
install(TARGETS INDIWebManagerApp ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
########### install files ###############
install(FILES INDIWebManagerApp.kcfg DESTINATION ${KDE_INSTALL_KCFGDIR})