summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
blob: 6e40f3aa4ae1ab5f0a2b3ace5da02363f9184632 (plain)
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
cmake_minimum_required(VERSION 3.5)

project(assignment-list VERSION 0.0.1 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED)

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)

option(USE_QT5 "Use Qt5, instead of Qt6" no)
option(USE_QT6 "Use Qt6, instead of Qt5" no)

set(qt_components "Core" "Gui" "Sql" "UiTools" "Widgets")
set(qt_names "Qt6" "Qt5")
if(USE_QT5)
	set(qt_names "Qt5")
	# Requires Qt version >= 5.4
elseif(USE_QT6)
	set(qt_names "Qt6")
endif()

find_package(QT NAMES ${qt_names} REQUIRED COMPONENTS ${qt_components})
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS ${qt_components})

message("Using Qt${QT_VERSION_MAJOR}")

set(qt_libraries "")
foreach(X ${qt_components})
	list(APPEND qt_libraries "Qt${QT_VERSION_MAJOR}::${X}")
endforeach()

set(project_sources
	"src/addEntryForm.cpp"
	"src/addEntryForm.h"
	"src/addGroupForm.cpp"
	"src/addGroupForm.h"
	"src/backend/db_sqlite.cpp"
	"src/backend/db_sqlite.h"
	"src/assignmentList.cpp"
	"src/assignmentList.h"
	"src/assignmentList.ui"
	"src/editGroupForm.cpp"
	"src/editGroupForm.h"
	"src/entry.cpp"
	"src/entry.h"
	"src/entryLayout.cpp"
	"src/entryLayout.h"
	"src/entryForm.ui"
	"src/group.cpp"
	"src/group.h"
	"src/groupLayout.cpp"
	"src/groupLayout.h"
	"src/groupForm.ui"
	"src/lib.cpp"
	"src/lib.h"
	"src/main.cpp"
	"src/preferencesDialog.cpp"
	"src/preferencesDialog.h"
	"src/preferencesDialog.ui"
	"src/rule.cpp"
	"src/rule.h"
	"src/ruleLayout.cpp"
	"src/ruleLayout.h"
	"src/settings.cpp"
	"src/settings.h"
)

add_executable(assignment-list
	${project_sources}
)

target_link_libraries(assignment-list ${qt_libraries})