-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
79 lines (67 loc) · 1.84 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
cmake_minimum_required(VERSION 3.12)
project(examples VERSION 0.1 LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# AUTOUIC doesn't work since .ui will be generated by qmluic.
# DO NOT ENABLE: set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
option(USE_QT6 "Use Qt6 even if Qt5 found")
if(USE_QT6)
find_package(Qt6 REQUIRED COMPONENTS Widgets)
else()
find_package(Qt5 5.15 COMPONENTS Widgets)
if(NOT Qt5_FOUND)
find_package(Qt6 REQUIRED COMPONENTS Widgets)
endif()
endif()
# Look up the installed qmluic. Set PATH, CMAKE_PREFIX_PATH, or CMAKE_MODULE_PATH
# if you've installed qmluic to non-standard location.
find_package(Qmluic REQUIRED)
# Help Qt Creator find our type stub
set(QML_IMPORT_PATH ${QMLUIC_QML_IMPORT_PATH} CACHE STRING "" FORCE)
add_subdirectory(customwidget)
add_executable(qmluic-examples
bindingloop.cpp
bindingloop.h
hgemaildialog.cpp
hgemaildialog.h
itemviews.cpp
itemviews.h
layoutflow.cpp
layoutflow.h
main.cpp
mainwindow.cpp
mainwindow.h
settingsdialog.cpp
settingsdialog.h
staticitemmodel.cpp
staticitemmodel.h
variouslayouts.cpp
variouslayouts.h
)
qmluic_target_qml_sources(qmluic-examples
BindingLoop.qml
HgEmailDialog.qml
ItemViews.qml
LayoutFlow.qml
MainWindow.qml
SettingsDialog.qml
StaticItemModel.qml
VariousLayouts.qml
)
target_compile_definitions(qmluic-examples
PRIVATE
# The following define makes your compiler emit warnings if you use
# any feature of Qt which has been marked as deprecated
QT_DEPRECATED_WARNINGS
# disables all the APIs deprecated before Qt 6.0.0
QT_DISABLE_DEPRECATED_BEFORE=0x060000
# disables erroneous QString cast, but allows QString("...")
QT_RESTRICTED_CAST_FROM_ASCII
)
target_link_libraries(qmluic-examples
PRIVATE
Qt::Widgets
)