-
Notifications
You must be signed in to change notification settings - Fork 9
/
CMakeLists.txt
421 lines (375 loc) · 11.4 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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
if (NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12)
endif ()
PROJECT(QtTesting)
IF(NOT DEFINED QtTesting_QT_VERSION)
SET(QtTesting_QT_VERSION "4" CACHE STRING "Expected Qt version")
MARK_AS_ADVANCED(QtTesting_QT_VERSION)
SET_PROPERTY(CACHE QtTesting_QT_VERSION PROPERTY STRINGS 4 5)
ENDIF()
IF(NOT (QtTesting_QT_VERSION VERSION_EQUAL "4" OR
QtTesting_QT_VERSION VERSION_EQUAL "5"))
message(FATAL_ERROR "Expected value for QtTesting_QT_VERSION is either '4' or '5'")
ENDIF()
set(qt_imported_targets)
IF(QtTesting_QT_VERSION VERSION_GREATER "4")
FIND_PACKAGE(Qt5 REQUIRED COMPONENTS Core Widgets)
SET(qt_imported_targets Qt5::Core Qt5::Widgets)
ELSE()
FIND_PACKAGE(Qt4 REQUIRED COMPONENTS QtGui)
SET(qt_imported_targets Qt4::QtCore Qt4::QtGui)
ENDIF()
IF(NOT DEFINED QT_TESTING_WITH_PYTHON)
OPTION(QT_TESTING_WITH_PYTHON "Enable Qt Testing with Python" OFF)
ENDIF()
IF(NOT DEFINED QtTesting_INSTALL_BIN_DIR)
SET(QtTesting_INSTALL_BIN_DIR bin)
ENDIF()
IF(NOT DEFINED QtTesting_INSTALL_INCLUDE_DIR)
SET(QtTesting_INSTALL_INCLUDE_DIR include/QtTesting)
ENDIF()
IF(NOT DEFINED QtTesting_INSTALL_LIB_DIR)
SET(QtTesting_INSTALL_LIB_DIR lib)
ENDIF()
IF(NOT DEFINED QtTesting_INSTALL_CMAKE_DIR)
SET(QtTesting_INSTALL_CMAKE_DIR lib/cmake/qttesting)
ENDIF()
IF(NOT DEFINED QT_TESTING_EVENT_PLAYBACK_DELAY)
SET(QT_TESTING_EVENT_PLAYBACK_DELAY "100" CACHE STRING "Delay between invocation of each testing event." FORCE)
MARK_AS_ADVANCED(QT_TESTING_EVENT_PLAYBACK_DELAY)
ENDIF()
IF(NOT QT_TESTING_INSTALL_EXPORT_NAME)
SET(QT_TESTING_INSTALL_EXPORT_NAME QtTestingTargets)
ENDIF()
# One can define QT_TESTING_CUSTOM_LIBRARY_PREFIX and/or
# QT_TESTING_CUSTOM_LIBRARY_SUFFIX to add prefix/suffix to libraries
# generated by thus project. Default is empty.
if(NOT DEFINED QT_TESTING_CUSTOM_LIBRARY_SUFFIX)
set(QT_TESTING_CUSTOM_LIBRARY_SUFFIX)
endif()
if(NOT DEFINED QT_TESTING_CUSTOM_LIBRARY_PREFIX)
set(QT_TESTING_CUSTOM_LIBRARY_PREFIX)
endif()
IF(QT_TESTING_WITH_PYTHON)
IF(NOT PythonLibs_FOUND)
FIND_PACKAGE(PythonLibs REQUIRED)
ENDIF()
IF(UNIX)
FIND_LIBRARY(PYTHON_UTIL_LIBRARY
NAMES util
PATHS /usr/lib
DOC "Utility library needed for vtkpython"
)
MARK_AS_ADVANCED(PYTHON_UTIL_LIBRARY)
IF(PYTHON_UTIL_LIBRARY)
SET(PYTHON_UTIL_LIBRARY_LIB ${PYTHON_UTIL_LIBRARY})
ENDIF()
ENDIF()
INCLUDE_DIRECTORIES(
${PYTHON_INCLUDE_PATH}
)
SET(PYTHON_MOCS
pqPythonEventObserver.h
pqPythonEventSource.h
)
SET(PYTHON_SRCS
pqPythonEventObserver.cxx
pqPythonEventObserver.h
pqPythonEventSource.cxx
pqPythonEventSource.h
)
ENDIF(QT_TESTING_WITH_PYTHON)
INCLUDE_DIRECTORIES(
${QtTesting_BINARY_DIR}
${QtTesting_SOURCE_DIR}
)
# Reduce the number of dirs that get included on moc command line
# since it causes issues on Windows 2000.
GET_DIRECTORY_PROPERTY(include_dirs_tmp INCLUDE_DIRECTORIES)
SET_DIRECTORY_PROPERTIES(PROPERTIES INCLUDE_DIRECTORIES "${MOC_INCLUDE_DIRS}")
SET(MOC_SRCS
pq3DViewEventPlayer.h
pq3DViewEventTranslator.h
pqAbstractActivateEventPlayer.h
pqAbstractBooleanEventPlayer.h
pqAbstractButtonEventTranslator.h
pqAbstractDoubleEventPlayer.h
pqAbstractIntEventPlayer.h
pqAbstractItemViewEventPlayer.h
pqAbstractItemViewEventPlayerBase.h
pqAbstractItemViewEventTranslator.h
pqAbstractItemViewEventTranslatorBase.h
pqAbstractMiscellaneousEventPlayer.h
pqAbstractSliderEventTranslator.h
pqAbstractStringEventPlayer.h
pqBasicWidgetEventPlayer.h
pqBasicWidgetEventTranslator.h
pqCheckEventOverlay.h
pqComboBoxEventTranslator.h
pqComboBoxEventPlayer.h
pqCommentEventPlayer.h
pqDoubleSpinBoxEventTranslator.h
pqEventComment.h
pqEventDispatcher.h
pqEventObserver.h
pqEventPlayer.h
pqEventRecorder.h
pqEventSource.h
pqEventTranslator.h
pqLineEditEventTranslator.h
pqListViewEventPlayer.h
pqListViewEventTranslator.h
pqMenuEventTranslator.h
pqNativeFileDialogEventPlayer.h
pqNativeFileDialogEventTranslator.h
pqPlayBackEventsDialog.h
pqRecordEventsDialog.h
pqSpinBoxEventTranslator.h
pqStdoutEventObserver.h
pqTabBarEventPlayer.h
pqTabBarEventTranslator.h
pqTableViewEventPlayer.h
pqTableViewEventTranslator.h
pqTestUtility.h
pqThreadedEventSource.h
pqTimer.h
pqTreeViewEventPlayer.h
pqTreeViewEventTranslator.h
pqWidgetEventPlayer.h
pqWidgetEventTranslator.h
)
IF(QtTesting_QT_VERSION VERSION_GREATER "4")
QT5_WRAP_CPP(MOC_BUILT_SOURCES
${MOC_SRCS}
${PYTHON_MOCS}
)
ELSE()
QT4_WRAP_CPP(MOC_BUILT_SOURCES
${MOC_SRCS}
${PYTHON_MOCS}
)
ENDIF()
SET_DIRECTORY_PROPERTIES(PROPERTIES INCLUDE_DIRECTORIES "${include_dirs_tmp}")
IF(QtTesting_QT_VERSION VERSION_GREATER "4")
QT5_WRAP_UI(UI_BUILT_SOURCES
pqPlayBackEventsDialog.ui
pqRecordEventsDialog.ui
)
ELSE()
QT4_WRAP_UI(UI_BUILT_SOURCES
pqPlayBackEventsDialog.ui
pqRecordEventsDialog.ui
)
ENDIF()
IF(QtTesting_QT_VERSION VERSION_GREATER "4")
QT5_ADD_RESOURCES(QRC_BUILT_SOURCES
Resources/QtTesting.qrc
)
ELSE()
QT4_ADD_RESOURCES(QRC_BUILT_SOURCES
Resources/QtTesting.qrc
)
ENDIF()
SET(QtTesting_SOURCES
pq3DViewEventPlayer.cxx
pq3DViewEventTranslator.cxx
pqAbstractActivateEventPlayer.cxx
pqAbstractBooleanEventPlayer.cxx
pqAbstractButtonEventTranslator.cxx
pqAbstractDoubleEventPlayer.cxx
pqAbstractIntEventPlayer.cxx
pqAbstractItemViewEventPlayer.cxx
pqAbstractItemViewEventPlayerBase.cxx
pqAbstractItemViewEventTranslator.cxx
pqAbstractItemViewEventTranslatorBase.cxx
pqAbstractMiscellaneousEventPlayer.cxx
pqAbstractSliderEventTranslator.cxx
pqAbstractStringEventPlayer.cxx
pqBasicWidgetEventPlayer.cxx
pqBasicWidgetEventTranslator.cxx
pqCheckEventOverlay.cxx
pqComboBoxEventTranslator.cxx
pqComboBoxEventPlayer.cxx
pqCommentEventPlayer.cxx
pqDoubleSpinBoxEventTranslator.cxx
pqEventComment.cxx
pqEventDispatcher.cxx
pqEventObserver.cxx
pqEventPlayer.cxx
pqEventRecorder.cxx
pqEventTranslator.cxx
pqLineEditEventTranslator.cxx
pqListViewEventPlayer.cxx
pqListViewEventTranslator.cxx
pqMenuEventTranslator.cxx
pqNativeFileDialogEventPlayer.cxx
pqNativeFileDialogEventTranslator.cxx
pqObjectNaming.cxx
pqPlayBackEventsDialog.cxx
pqRecordEventsDialog.cxx
pqSpinBoxEventTranslator.cxx
pqStdoutEventObserver.cxx
pqTabBarEventPlayer.cxx
pqTabBarEventTranslator.cxx
pqTableViewEventPlayer.cxx
pqTableViewEventTranslator.cxx
pqTestUtility.cxx
pqThreadedEventSource.cxx
pqTimer.cxx
pqTreeViewEventPlayer.cxx
pqTreeViewEventTranslator.cxx
pqWidgetEventPlayer.cxx
pqWidgetEventTranslator.cxx
)
SET(QtTesting_DEVEL_HEADERS
QtTestingExport.h
pq3DViewEventPlayer.h
pq3DViewEventTranslator.h
pqAbstractActivateEventPlayer.h
pqAbstractBooleanEventPlayer.h
pqAbstractButtonEventTranslator.h
pqAbstractDoubleEventPlayer.h
pqAbstractIntEventPlayer.h
pqAbstractItemViewEventPlayer.h
pqAbstractItemViewEventPlayerBase.h
pqAbstractItemViewEventTranslator.h
pqAbstractItemViewEventTranslatorBase.h
pqAbstractMiscellaneousEventPlayer.h
pqAbstractSliderEventTranslator.h
pqAbstractStringEventPlayer.h
pqBasicWidgetEventPlayer.h
pqBasicWidgetEventTranslator.h
pqCheckEventOverlay.h
pqComboBoxEventTranslator.h
pqComboBoxEventPlayer.h
pqCommentEventPlayer.h
pqDoubleSpinBoxEventTranslator.h
pqEventComment.h
pqEventDispatcher.h
pqEventObserver.h
pqEventPlayer.h
pqEventRecorder.h
pqEventSource.h
pqEventTranslator.h
pqEventTypes.h
pqLineEditEventTranslator.h
pqListViewEventPlayer.h
pqListViewEventTranslator.h
pqMenuEventTranslator.h
pqNativeFileDialogEventPlayer.h
pqNativeFileDialogEventTranslator.h
pqObjectNaming.h
pqPlayBackEventsDialog.h
pqRecordEventsDialog.h
pqSpinBoxEventTranslator.h
pqStdoutEventObserver.h
pqTabBarEventPlayer.h
pqTabBarEventTranslator.h
pqTableViewEventPlayer.h
pqTableViewEventTranslator.h
pqTestUtility.h
pqThreadedEventSource.h
pqTimer.h
pqTreeViewEventPlayer.h
pqTreeViewEventTranslator.h
pqWidgetEventPlayer.h
pqWidgetEventTranslator.h
${QtTesting_BINARY_DIR}/QtTestingConfigure.h
)
ADD_LIBRARY(QtTesting
${QtTesting_SOURCES}
${MOC_BUILT_SOURCES}
${UI_BUILT_SOURCES}
${QRC_BUILT_SOURCES}
${PYTHON_SRCS}
)
# Set library name to include custom prefixes/suffixes.
set_property(TARGET QtTesting
PROPERTY OUTPUT_NAME ${QT_TESTING_CUSTOM_LIBRARY_PREFIX}QtTesting${QT_TESTING_CUSTOM_LIBRARY_SUFFIX})
SOURCE_GROUP("Generated" FILES
${MOC_BUILT_SOURCES}
${UI_BUILT_SOURCES}
)
TARGET_LINK_LIBRARIES(QtTesting
${qt_imported_targets}
)
TARGET_INCLUDE_DIRECTORIES(
QtTesting
PUBLIC
$<INSTALL_INTERFACE:${QtTesting_INSTALL_INCLUDE_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
)
IF(QT_TESTING_WITH_PYTHON)
TARGET_LINK_LIBRARIES(QtTesting
${PYTHON_LIBRARIES}
${PYTHON_UTIL_LIBRARY_LIB}
)
ENDIF()
SET(QTTESTING_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
CONFIGURE_FILE(${QtTesting_SOURCE_DIR}/QtTestingConfigure.h.in
${QtTesting_BINARY_DIR}/QtTestingConfigure.h)
INSTALL(TARGETS QtTesting
EXPORT ${QT_TESTING_INSTALL_EXPORT_NAME}
RUNTIME DESTINATION ${QtTesting_INSTALL_BIN_DIR} COMPONENT Runtime
LIBRARY DESTINATION ${QtTesting_INSTALL_LIB_DIR} COMPONENT Runtime
ARCHIVE DESTINATION ${QtTesting_INSTALL_LIB_DIR} COMPONENT Development)
if (NOT DEFINED BUILD_EXAMPLES)
option(BUILD_EXAMPLES "Build examples" OFF)
endif ()
if (BUILD_EXAMPLES)
add_subdirectory(Examples)
endif ()
include(CTest)
IF(BUILD_TESTING)
add_subdirectory(Testing)
ENDIF()
export(TARGETS QtTesting FILE ${QtTesting_BINARY_DIR}/QtTestingExports.cmake)
# Set up the build export configuration
set(QtTesting_EXPORT_FILE "${QtTesting_BINARY_DIR}/QtTestingConfig.cmake")
configure_file(
"${QtTesting_SOURCE_DIR}/QtTestingConfig.cmake.in"
"${QtTesting_EXPORT_FILE}"
@ONLY
)
# Set up the install export
IF(IS_ABSOLUTE QtTesting_INSTALL_INCLUDE_DIR)
set(QtTesting_INSTALL_INCLUDE_FULL_DIR "${QtTesting_INSTALL_INCLUDE_DIR}")
ELSE()
set(QtTesting_INSTALL_INCLUDE_FULL_DIR "${CMAKE_INSTALL_PREFIX}/${QtTesting_INSTALL_INCLUDE_DIR}")
get_filename_component(QtTesting_INSTALL_INCLUDE_FULL_DIR "${QtTesting_INSTALL_INCLUDE_FULL_DIR}" ABSOLUTE)
ENDIF()
IF(IS_ABSOLUTE QtTesting_INSTALL_LIB_DIR)
set(QtTesting_INSTALL_LIB_FULL_DIR "${QtTesting_INSTALL_LIB_DIR}")
ELSE()
set(QtTesting_INSTALL_LIB_FULL_DIR "${CMAKE_INSTALL_PREFIX}/${QtTesting_INSTALL_LIB_DIR}")
get_filename_component(QtTesting_INSTALL_LIB_FULL_DIR "${QtTesting_INSTALL_LIB_FULL_DIR}" ABSOLUTE)
ENDIF()
set(QtTesting_EXPORT_INSTALL_FILE "${QtTesting_BINARY_DIR}/CMakeFiles/QtTestingConfig.cmake")
configure_file(
"${QtTesting_SOURCE_DIR}/QtTestingConfig-install.cmake.in"
"${QtTesting_EXPORT_INSTALL_FILE}"
@ONLY
)
include(CMakePackageConfigHelpers)
# Configure '<PROJECT-NAME>Config.cmake'
# Use variables:
# * targets_export_name
# * PROJECT_NAME
configure_package_config_file(
"${PROJECT_NAME}Config-install.cmake.in"
"${QtTesting_EXPORT_INSTALL_FILE}"
INSTALL_DESTINATION "${QtTesting_INSTALL_CMAKE_DIR}"
NO_CHECK_REQUIRED_COMPONENTS_MACRO
)
IF(NOT QtTesting_INSTALL_NO_DEVELOPMENT)
install( FILES ${QtTesting_DEVEL_HEADERS}
DESTINATION ${QtTesting_INSTALL_INCLUDE_DIR}
)
# Configure the CMake EXPORT file during installation
install( FILES ${QtTesting_BINARY_DIR}/CMakeFiles/QtTestingConfig.cmake
DESTINATION ${QtTesting_INSTALL_CMAKE_DIR}
)
install( EXPORT ${QT_TESTING_INSTALL_EXPORT_NAME}
DESTINATION ${QtTesting_INSTALL_CMAKE_DIR}
)
ENDIF()