@@ -11,8 +11,6 @@ cmake_minimum_required(VERSION 2.8)
11
11
project (PythonQt)
12
12
#-----------------------------------------------------------------------------
13
13
14
- include (CTestUseLaunchers OPTIONAL )
15
-
16
14
#-----------------------------------------------------------------------------
17
15
# Python libraries
18
16
@@ -71,7 +69,9 @@ if(QT4_FOUND)
71
69
endif ()
72
70
set (QT_USE_QT${qtlib_uppercase} ${PythonQt_Wrap_Qt${qtlib} })
73
71
endforeach ()
74
-
72
+
73
+ set (QT_USE_QTTEST ${BUILD_TESTING} )
74
+
75
75
include (${QT_USE_FILE} )
76
76
else ()
77
77
message (FATAL_ERROR "error: Qt4 was not found on your system. You probably need to set the QT_QMAKE_EXECUTABLE variable" )
@@ -238,3 +238,35 @@ install(TARGETS PythonQt
238
238
LIBRARY DESTINATION lib
239
239
ARCHIVE DESTINATION lib)
240
240
install (FILES ${headers} DESTINATION include /PythonQt)
241
+
242
+ #-----------------------------------------------------------------------------
243
+ # Testing
244
+
245
+ option (BUILD_TESTING "Build the testing tree." OFF )
246
+ include (CTest)
247
+
248
+ if (BUILD_TESTING)
249
+ create_test_sourcelist (test_sources PythonQtCppTests.cpp
250
+ tests/PythonQtTestMain.cpp
251
+ )
252
+
253
+ list (APPEND test_sources
254
+ tests/PythonQtTests.cpp
255
+ tests/PythonQtTests.h
256
+ )
257
+
258
+ QT4_WRAP_CPP(test_sources
259
+ tests/PythonQtTests.h
260
+ )
261
+
262
+ set_property (SOURCE tests/PythonQtTestMain.cpp PROPERTY COMPILE_DEFINITIONS "main=tests_PythonQtTestMain" )
263
+
264
+ add_executable (PythonQtCppTests ${test_sources} )
265
+ target_link_libraries (PythonQtCppTests PythonQt)
266
+
267
+ add_test (
268
+ NAME tests_PythonQtTestMain
269
+ COMMAND ${Slicer_LAUNCH_COMMAND} $<TARGET_FILE:PythonQtCppTests> tests/PythonQtTestMain
270
+ )
271
+ endif ()
272
+
0 commit comments