summaryrefslogtreecommitdiffstats
path: root/tests/auto/cmake/test_testlib_definitions/CMakeLists.txt
diff options
context:
space:
mode:
authorStephen Kelly <stephen.kelly@kdab.com>2012-07-18 22:25:56 +0200
committerQt by Nokia <qt-info@nokia.com>2012-07-24 08:44:27 +0200
commit45cb8be4f9ab2b5b823dda104376b159c9123163 (patch)
tree833e53808d216375ca10a84a384775f897f6c49f /tests/auto/cmake/test_testlib_definitions/CMakeLists.txt
parent4eb64827515f7d72e3c5cf259c4bc2c1cc0d58bf (diff)
Add tests of the various testlib definition possibilities.
The behavior of QTEST_MAIN depends on whether QT_GUI_LIB or QT_WIDGETS_LIB is defined. It could create a QGuiApplication or QApplication which could cause linking issues if the corresponding library is not linked to. The failure cases are also tested. Change-Id: I61ed0bc760564ef42ce1dbd86c83c06348c860ff Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Diffstat (limited to 'tests/auto/cmake/test_testlib_definitions/CMakeLists.txt')
-rw-r--r--tests/auto/cmake/test_testlib_definitions/CMakeLists.txt38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/auto/cmake/test_testlib_definitions/CMakeLists.txt b/tests/auto/cmake/test_testlib_definitions/CMakeLists.txt
new file mode 100644
index 0000000000..c370e8effa
--- /dev/null
+++ b/tests/auto/cmake/test_testlib_definitions/CMakeLists.txt
@@ -0,0 +1,38 @@
+
+cmake_minimum_required(VERSION 2.8.3)
+
+project(test_testlib_definitions)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+macro(test_testlib_project _module)
+ find_package(Qt5${_module} REQUIRED)
+ find_package(Qt5Test REQUIRED)
+
+ add_definitions(
+ ${Qt5${_module}_DEFINITIONS}
+ ${Qt5Test_DEFINITIONS}
+ )
+
+ include_directories(
+ ${Qt5${_module}_INCLUDE_DIRS}
+ ${Qt5Test_INCLUDE_DIRS}
+ )
+
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5${_module}_EXECUTABLE_COMPILE_FLAGS}")
+
+ set(main_file "${CMAKE_CURRENT_SOURCE_DIR}/../main.cpp")
+ set(moc_file "${CMAKE_CURRENT_BINARY_DIR}/main.moc")
+
+ qt5_generate_moc("${main_file}" "${moc_file}")
+
+ add_executable(testapp_${_module} "${main_file}" "${moc_file}")
+ target_link_libraries(testapp_${_module}
+ ${Qt5${_module}_LIBRARIES}
+ ${Qt5Test_LIBRARIES}
+ )
+endmacro()
+
+add_subdirectory(core_only)
+add_subdirectory(gui)
+add_subdirectory(widgets)