diff options
author | Sebastian Holtermann <sebholt@xwmw.org> | 2018-11-27 11:41:20 (GMT) |
---|---|---|
committer | Sebastian Holtermann <sebholt@xwmw.org> | 2018-11-28 11:51:19 (GMT) |
commit | 2ef640819fcf9ca741b3ebcb543b9a01ffb40689 (patch) | |
tree | 22c385086aa71e29601caba27d94593ea642407b /Tests/QtAutogen/AutogenCoreTest.cmake | |
parent | b736f5f269a1d04532901326304597a284af2c70 (diff) | |
download | CMake-2ef640819fcf9ca741b3ebcb543b9a01ffb40689.zip CMake-2ef640819fcf9ca741b3ebcb543b9a01ffb40689.tar.gz CMake-2ef640819fcf9ca741b3ebcb543b9a01ffb40689.tar.bz2 |
Autogen: Tests: Differentiate between Qt core and Qt gui tests
Some AUTOGEN tests require the Qt core libraries only and
some require the Qt gui libraries to function.
This replaces the AutogenTest.cmake script with two specific
AutogenCoreTest.cmake and AutogenGuiTest.cmake scripts that
are included on demand.
Diffstat (limited to 'Tests/QtAutogen/AutogenCoreTest.cmake')
-rw-r--r-- | Tests/QtAutogen/AutogenCoreTest.cmake | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/Tests/QtAutogen/AutogenCoreTest.cmake b/Tests/QtAutogen/AutogenCoreTest.cmake new file mode 100644 index 0000000..5803859 --- /dev/null +++ b/Tests/QtAutogen/AutogenCoreTest.cmake @@ -0,0 +1,55 @@ + +# 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 EQUAL 4) + + find_package(Qt4 REQUIRED QtCore) + include(UseQt4) + + set(QT_QTCORE_TARGET Qt4::QtCore) + + # Qt macros + macro(qtx_wrap_cpp) + qt4_wrap_cpp(${ARGN}) + endmacro() + macro(qtx_generate_moc) + qt4_generate_moc(${ARGN}) + endmacro() + +elseif(QT_TEST_VERSION EQUAL 5) + + find_package(Qt5Core REQUIRED) + + set(QT_QTCORE_TARGET Qt5::Core) + set(QT_LIBRARIES Qt5::Core) + + # Include directories + include_directories(${Qt5Core_INCLUDE_DIRS}) + + # Definitions + 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 +) |