-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
121 lines (105 loc) · 2.12 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
#
# Min version of CMake
#
cmake_minimum_required(VERSION 3.8)
#
# Project
#
project(qmldev
VERSION 0.1.0
LANGUAGES CXX
DESCRIPTION "QML development helper with support for automatic hot reloading."
)
#
# Setup CMake, Qt, load our utilities, etc.
#
include (cmake/Setup.cmake)
include (cmake/CMakeUtils/Qt.cmake)
include (cmake/CMakeUtils/Utils.cmake)
#
# Utils
#
add_subdirectory (QtUtils)
#
# The library
#
add_executable (qmldev WIN32
Main.cpp
)
#
# Include directories
#
target_include_directories (qmldev
PRIVATE
QtUtils
)
#
# compiler's requirements
#
target_compile_features (qmldev
PRIVATE
cxx_std_17
)
#
# libs
#
target_link_libraries(qmldev
PRIVATE
Qt5::Qml
Qt5::Quick
Qt5::QuickControls2
Qt5::Widgets
# QtUtils
QtUtils
)
#
# Compile definitions
#
target_compile_definitions (qmldev
PRIVATE
# Qt/QML debug stuff
$<$<NOT:$<CONFIG:Release>>:QT_QML_DEBUG>
$<$<CONFIG:Release>:QT_NO_DEBUG>
$<$<CONFIG:Release>:QT_NO_DEBUG_OUTPUT>
$<$<CONFIG:Release>:QT_NO_INFO_OUTPUT>
$<$<CONFIG:Release>:QT_NO_WARNING_OUTPUT>
# Build type
$<$<CONFIG:Release>:RELEASE>
$<$<NOT:$<CONFIG:Release>>:DEBUG>
# Platforms
$<$<PLATFORM_ID:Windows>:WINDOWS>
$<$<PLATFORM_ID:Linux>:LINUX>
$<$<PLATFORM_ID:Darwin>:MACOS>
# Compilers
$<$<CXX_COMPILER_ID:MSVC>:MSVC>
$<$<CXX_COMPILER_ID:Clang>:CLANG>
$<$<CXX_COMPILER_ID:GNU>:GCC>
# Disable some annoying warnings
# note that Clang on Windows uses the same STL as MSVC, so it suffers from the same warnings
$<$<PLATFORM_ID:Windows>:_CRT_SECURE_NO_WARNINGS>
# QML debug
$<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>
)
#
# Compile options
#
target_compile_options (qmldev
PRIVATE
# Warning configurations
$<$<CXX_COMPILER_ID:MSVC>:/W4 $<$<BOOL:${WARNINGS_AS_ERRORS}>:/WX>>
$<$<CXX_COMPILER_ID:Clang>:-Wall $<$<BOOL:${WARNINGS_AS_ERRORS}>:-Werror>>
$<$<CXX_COMPILER_ID:GNU>:-Wall $<$<BOOL:${WARNINGS_AS_ERRORS}>:-Werror>>
)
#
# Installation
#
install_qt_target (qmldev "${CMAKE_CURRENT_SOURCE_DIR}/QmlDeploy"
RUNTIME DESTINATION .
LIBRARY DESTINATION .
ARCHIVE DESTINATION .
)
install (FILES
Main.qml
Error.qml
DESTINATION .
)