Add a test for Qt5Automoc
The same source is used as for the Qt4Automoc test.
This commit is contained in:
parent
27fb96b978
commit
e7813b15a6
|
@ -1003,19 +1003,34 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
|
||||||
)
|
)
|
||||||
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/QtAutomocNoQt")
|
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/QtAutomocNoQt")
|
||||||
|
|
||||||
if(QT4_WORKS AND QT_QTGUI_FOUND)
|
find_package(Qt5Widgets QUIET NO_MODULE)
|
||||||
add_test(QtAutomoc ${CMAKE_CTEST_COMMAND}
|
if(Qt5Widgets_FOUND)
|
||||||
|
add_test(Qt5Automoc ${CMAKE_CTEST_COMMAND}
|
||||||
--build-and-test
|
--build-and-test
|
||||||
"${CMake_SOURCE_DIR}/Tests/QtAutomoc"
|
"${CMake_SOURCE_DIR}/Tests/QtAutomoc"
|
||||||
"${CMake_BINARY_DIR}/Tests/QtAutomoc"
|
"${CMake_BINARY_DIR}/Tests/Qt5Automoc"
|
||||||
${build_generator_args}
|
${build_generator_args}
|
||||||
--build-project QtAutomoc
|
--build-project QtAutomoc
|
||||||
--build-exe-dir "${CMake_BINARY_DIR}/Tests/QtAutomoc"
|
--build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt5Automoc"
|
||||||
--force-new-ctest-process
|
--force-new-ctest-process
|
||||||
--build-options -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}
|
--build-options -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} -DQT_TEST_VERSION=5
|
||||||
--test-command ${CMAKE_CTEST_COMMAND} -V
|
--test-command ${CMAKE_CTEST_COMMAND} -V
|
||||||
)
|
)
|
||||||
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/QtAutomoc")
|
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt5Automoc")
|
||||||
|
endif()
|
||||||
|
if(QT4_WORKS AND QT_QTGUI_FOUND)
|
||||||
|
add_test(Qt4Automoc ${CMAKE_CTEST_COMMAND}
|
||||||
|
--build-and-test
|
||||||
|
"${CMake_SOURCE_DIR}/Tests/QtAutomoc"
|
||||||
|
"${CMake_BINARY_DIR}/Tests/Qt4Automoc"
|
||||||
|
${build_generator_args}
|
||||||
|
--build-project QtAutomoc
|
||||||
|
--build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt4Automoc"
|
||||||
|
--force-new-ctest-process
|
||||||
|
--build-options -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} -DQT_TEST_VERSION=4
|
||||||
|
--test-command ${CMAKE_CTEST_COMMAND} -V
|
||||||
|
)
|
||||||
|
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4Automoc")
|
||||||
endif()
|
endif()
|
||||||
if(QT4_WORKS AND QT_QTGUI_FOUND)
|
if(QT4_WORKS AND QT_QTGUI_FOUND)
|
||||||
add_test(Qt4Targets ${CMAKE_CTEST_COMMAND}
|
add_test(Qt4Targets ${CMAKE_CTEST_COMMAND}
|
||||||
|
|
|
@ -4,5 +4,5 @@ set(CMAKE_AUTOMOC ON)
|
||||||
set(CMAKE_BUILD_INTERFACE_INCLUDES ON)
|
set(CMAKE_BUILD_INTERFACE_INCLUDES ON)
|
||||||
|
|
||||||
add_library(libA SHARED libA.cpp)
|
add_library(libA SHARED libA.cpp)
|
||||||
target_link_libraries(libA LINK_PUBLIC Qt4::QtCore)
|
target_link_libraries(libA LINK_PUBLIC ${QT_QTCORE_TARGET})
|
||||||
generate_export_header(libA)
|
generate_export_header(libA)
|
||||||
|
|
|
@ -2,9 +2,28 @@ cmake_minimum_required(VERSION 2.8)
|
||||||
|
|
||||||
project(QtAutomoc)
|
project(QtAutomoc)
|
||||||
|
|
||||||
find_package(Qt4 REQUIRED)
|
if (QT_TEST_VERSION STREQUAL 4)
|
||||||
|
find_package(Qt4 REQUIRED)
|
||||||
|
|
||||||
|
include(UseQt4)
|
||||||
|
|
||||||
|
set(QT_QTCORE_TARGET Qt4::QtCore)
|
||||||
|
else()
|
||||||
|
if (NOT QT_TEST_VERSION STREQUAL 5)
|
||||||
|
message(SEND_ERROR "Invalid Qt version specified.")
|
||||||
|
endif()
|
||||||
|
find_package(Qt5Widgets REQUIRED)
|
||||||
|
|
||||||
|
set(QT_QTCORE_TARGET Qt5::Core)
|
||||||
|
|
||||||
|
include_directories(${Qt5Widgets_INCLUDE_DIRS})
|
||||||
|
set(QT_LIBRARIES Qt5::Widgets)
|
||||||
|
|
||||||
|
if(Qt5_POSITION_INDEPENDENT_CODE)
|
||||||
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
include(UseQt4)
|
|
||||||
|
|
||||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue