-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathCMakeLists.txt
178 lines (159 loc) · 3.38 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
cmake_minimum_required(
VERSION 3.24
)
cmake_policy(
VERSION
3.24
)
if(wants_clang)
set(CMAKE_C_COMPILER
"clang"
)
set(CMAKE_CXX_COMPILER
"clang++"
)
endif()
if(NOT
DEFINED
ENV{Qt5_DIR}
)
message(
FATAL_ERROR
"You must set Qt5_DIR. This project was intended to be very\
strict about requiring your explicit path to your chosen Qt toolchain.\
(remove this check from the project if/when no longer relevant)"
)
endif()
if(NOT
DEFINED
ENV{Qt6_DIR}
)
message(
FATAL_ERROR
"You must set Qt6_DIR. This project was intended to be very\
strict about requiring your explicit path to your chosen Qt toolchain.\
(remove this check from the project if/when no longer relevant)"
)
endif()
project(
gui_app
)
set(CMAKE_CXX_STANDARD
17
)
if(ANDROID)
find_package(
Qt6
CONFIG
REQUIRED
COMPONENTS Core
Qml
Quick
QuickControls2
Test
Widgets
)
qt_standard_project_setup(
REQUIRES
6.5.3
)
else()
find_package(
Qt5
CONFIG
REQUIRED
COMPONENTS Core
Qml
Quick
QuickControls2
Test
Widgets
)
endif()
# Regarding QT_DEFAULT_MAJOR_VERSION, see:
# https://doc.qt.io/qt-5/cmake-variable-reference.html
message(
STATUS
"After find_package, QT_DEFAULT_MAJOR_VERSION is ${QT_DEFAULT_MAJOR_VERSION}"
)
set(CMAKE_AUTOMOC
ON
)
set(CMAKE_AUTORCC
ON
)
set(CMAKE_AUTOUIC
ON
)
# ##############################################################################
# Begin section: based on the book "Professional CMake" by Craig Scott
#
# ISBN 978-1-925904-24-6, 15th edition. 2023.
# https://crascit.com/professional-cmake/
#
# 34.5.2. Target Output Locations
#
# When all targets should use the same consistent output locations, these
# variables can be set at the top of the project so that the properties don't
# have to be set for every target individually. To allow the project to be
# incorporated into a larger project hierarchy, these variables should only be
# set if they are not already set so that parent projects can override the
# output locations. They should also use a location relative to
# CMAKE_CURRENT_BINARY_DIR rather than CMAKE_BINARY_DIR.
# include( GNUInstallDirs ) # <--- uncomment to distinguish 'bin/' from 'lib/'
set(stageDir
${CMAKE_CURRENT_BINARY_DIR}/stage
)
if(NOT
CMAKE_RUNTIME_OUTPUT_DIRECTORY
)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
${stageDir}/${CMAKE_INSTALL_BINDIR}
)
endif()
if(NOT
CMAKE_LIBRARY_OUTPUT_DIRECTORY
)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY
${stageDir}/${CMAKE_INSTALL_LIBDIR}
)
endif()
if(NOT
CMAKE_ARCHIVE_OUTPUT_DIRECTORY
)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY
${stageDir}/${CMAKE_INSTALL_LIBDIR}
)
endif()
# End section: based on the book "Professional CMake" by Craig Scott
# ##############################################################################
include(
cmake_include/cross_platform_settings.cmake
)
add_subdirectory(
src/app
)
add_subdirectory(
src/lib_app
)
add_subdirectory(
src/lib_example_shared
)
add_subdirectory(
src/libstyles
)
add_subdirectory(
src/libtests
)
add_subdirectory(
src/minutil
)
add_subdirectory(
src/util
)
add_subdirectory(
third_party/googletest-release-1.11.0/googlemock
)
add_subdirectory(
third_party/googletest-release-1.11.0/googletest
)