-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
103 lines (93 loc) · 2 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
#
# This library is meant to be used by just `add_subdirectory ("path_to_this_folder")`
# It will define a QtUtils library that you can then add to your target using `target_add_libraries`
# It will provide all required include paths, etc.
#
# Just before adding this directory, you can define a few variables to customize the
# built library:
#
# - QT_UTILS_NAMESPACE : By default, no namespace is used. But since the names of the
# classes defined in this lib might clash with yours, you can
# set this variable to a non-empty string, which will then
# be used as the namespace for all QtUtils classes.
#
#
# Check options
#
if (DEFINED QT_UTILS_NAMESPACE)
set (QT_UTILS_NAMESPACE_USED 1)
else ()
set (QT_UTILS_NAMESPACE_USED 0)
endif ()
#
# Override automoc options, in case the parent scope was using a precompiled header.
#
set (CMAKE_AUTOMOC ON)
set (CMAKE_AUTOMOC_MOC_OPTIONS "")
set (CMAKE_AUTORCC OFF)
#
# Get the required Qt libraries
#
find_package (Qt5 5
COMPONENTS
Quick
Widgets
REQUIRED
)
#
# The library
#
add_library (QtUtils
File.cpp
File.h
HttpRequest.cpp
HttpRequest.h
Job.cpp
Job.h
QuickView.cpp
QuickView.h
Settings.cpp
Settings.h
Utils.h
)
#
# The include directories
#
target_include_directories (QtUtils
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
)
#
# The Qt libraries
#
target_link_libraries (QtUtils
PUBLIC
Qt5::Quick
Qt5::Widgets
)
#
# compiler's requirements
#
target_compile_features (QtUtils
PUBLIC
cxx_std_17
)
#
# Some definitions
#
target_compile_definitions (QtUtils
PRIVATE
# Disable every possible debug things from Qt when in Release
$<$<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>
# Platform
$<$<PLATFORM_ID:Windows>:WINDOWS>
$<$<PLATFORM_ID:Linux>:LINUX>
$<$<PLATFORM_ID:Darwin>:MACOS>
PUBLIC
# Namespace
$<${QT_UTILS_NAMESPACE_USED}:QT_UTILS_NAMESPACE=${QT_UTILS_NAMESPACE}>
)