summaryrefslogtreecommitdiffstats
path: root/Tests/QtAutogen/AutogenTest.cmake
diff options
context:
space:
mode:
authorSebastian Holtermann <sebholt@xwmw.org>2017-12-08 16:09:30 (GMT)
committerSebastian Holtermann <sebholt@xwmw.org>2017-12-13 12:48:27 (GMT)
commit227a7974f426e0966d1736c66dd606b068985d1b (patch)
tree1b0048d6c54e4c0d88c1313bc6bc30c3f0c18610 /Tests/QtAutogen/AutogenTest.cmake
parentbd10c3cf82f6e9d58b121498eaa2b9d8cc19dd2f (diff)
downloadCMake-227a7974f426e0966d1736c66dd606b068985d1b.zip
CMake-227a7974f426e0966d1736c66dd606b068985d1b.tar.gz
CMake-227a7974f426e0966d1736c66dd606b068985d1b.tar.bz2
Autogen: Tests: Add basic scripts for separate tests
Diffstat (limited to 'Tests/QtAutogen/AutogenTest.cmake')
-rw-r--r--Tests/QtAutogen/AutogenTest.cmake53
1 files changed, 53 insertions, 0 deletions
diff --git a/Tests/QtAutogen/AutogenTest.cmake b/Tests/QtAutogen/AutogenTest.cmake
new file mode 100644
index 0000000..8c0a14f
--- /dev/null
+++ b/Tests/QtAutogen/AutogenTest.cmake
@@ -0,0 +1,53 @@
+
+# Tell find_package(Qt5) where to find Qt.
+if(QT_QMAKE_EXECUTABLE)
+ get_filename_component(Qt_BIN_DIR "${QT_QMAKE_EXECUTABLE}" PATH)
+ get_filename_component(Qt_PREFIX_DIR "${Qt_BIN_DIR}" PATH)
+ list(APPEND CMAKE_PREFIX_PATH ${Qt_PREFIX_DIR})
+endif()
+
+if (QT_TEST_VERSION STREQUAL 4)
+ find_package(Qt4 REQUIRED)
+ include(UseQt4)
+
+ set(QT_QTCORE_TARGET Qt4::QtCore)
+ set(QT_QTGUI_TARGET Qt4::QtGui)
+
+ # Qt macros
+ macro(qtx_wrap_cpp)
+ qt4_wrap_cpp(${ARGN})
+ endmacro()
+ macro(qtx_generate_moc)
+ qt4_generate_moc(${ARGN})
+ endmacro()
+
+elseif(QT_TEST_VERSION STREQUAL 5)
+ find_package(Qt5Widgets REQUIRED)
+
+ set(QT_QTCORE_TARGET Qt5::Core)
+ set(QT_QTGUI_TARGET Qt5::Widgets)
+
+ include_directories(${Qt5Widgets_INCLUDE_DIRS})
+ set(QT_LIBRARIES Qt5::Widgets)
+
+ if(Qt5_POSITION_INDEPENDENT_CODE AND CMAKE_CXX_COMPILE_OPTIONS_PIC)
+ add_definitions(${CMAKE_CXX_COMPILE_OPTIONS_PIC})
+ endif()
+
+ # Qt macros
+ macro(qtx_wrap_cpp)
+ qt5_wrap_cpp(${ARGN})
+ endmacro()
+ macro(qtx_generate_moc)
+ qt5_generate_moc(${ARGN})
+ endmacro()
+
+else()
+ message(SEND_ERROR "Invalid Qt version specified: ${QT_TEST_VERSION}")
+endif()
+
+# Get Qt compile features
+get_property(QT_COMPILE_FEATURES
+ TARGET ${QT_QTCORE_TARGET}
+ PROPERTY INTERFACE_COMPILE_FEATURES
+)