Commit 2ef64081 authored by Sebastian Holtermann's avatar Sebastian Holtermann
Browse files

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.
parent b736f5f2
# 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
)
......@@ -7,11 +7,11 @@ if(QT_QMAKE_EXECUTABLE)
endif()
if (QT_TEST_VERSION EQUAL 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)
......@@ -22,14 +22,16 @@ if (QT_TEST_VERSION EQUAL 4)
endmacro()
elseif(QT_TEST_VERSION EQUAL 5)
find_package(Qt5Widgets REQUIRED)
set(QT_QTCORE_TARGET Qt5::Core)
set(QT_QTGUI_TARGET Qt5::Widgets)
set(QT_LIBRARIES Qt5::Widgets)
# Include directories
include_directories(${Qt5Widgets_INCLUDE_DIRS})
set(QT_LIBRARIES Qt5::Widgets)
# Definitions
if(Qt5_POSITION_INDEPENDENT_CODE AND CMAKE_CXX_COMPILE_OPTIONS_PIC)
add_definitions(${CMAKE_CXX_COMPILE_OPTIONS_PIC})
endif()
......
cmake_minimum_required(VERSION 3.11)
project(AutogenOriginDependsOff)
include("../AutogenTest.cmake")
include("../AutogenCoreTest.cmake")
set(CSD ${CMAKE_CURRENT_SOURCE_DIR})
set(CBD ${CMAKE_CURRENT_BINARY_DIR})
......
cmake_minimum_required(VERSION 3.10)
project(AutogenOriginDependsOn)
include("../AutogenTest.cmake")
include("../AutogenCoreTest.cmake")
include_directories(${CMAKE_CURRENT_BINARY_DIR})
set(CSD ${CMAKE_CURRENT_SOURCE_DIR})
......
cmake_minimum_required(VERSION 3.10)
project(AutogenTargetDepends)
include("../AutogenTest.cmake")
include("../AutogenCoreTest.cmake")
include_directories(${CMAKE_CURRENT_BINARY_DIR})
set(CSD ${CMAKE_CURRENT_SOURCE_DIR})
......
cmake_minimum_required(VERSION 3.10)
project(Complex)
include("../AutogenTest.cmake")
include("../AutogenGuiTest.cmake")
# -- Test: AUTOMOC AUTORCC AUTOUIC
add_definitions(-DFOO -DSomeDefine="Barx")
......
cmake_minimum_required(VERSION 3.12)
project(GlobalAutogenTarget)
include("../AutogenTest.cmake")
include("../AutogenCoreTest.cmake")
# This tests
# CMAKE_GLOBAL_AUTOGEN_TARGET,
......
cmake_minimum_required(VERSION 3.12)
project(GAT)
include("../../AutogenTest.cmake")
include("../../AutogenCoreTest.cmake")
# Include directories
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
......
# Use a low minimum version
cmake_minimum_required(VERSION 3.0)
project(LowMinimumVersion)
include("../AutogenTest.cmake")
include("../AutogenGuiTest.cmake")
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
......
cmake_minimum_required(VERSION 3.10)
project(MacOsFW)
include("../AutogenTest.cmake")
include("../AutogenGuiTest.cmake")
find_package(Qt5Test REQUIRED)
......
cmake_minimum_required(VERSION 3.10)
project(MocCMP0071)
include("../AutogenTest.cmake")
include("../AutogenCoreTest.cmake")
add_subdirectory(OLD)
add_subdirectory(NEW)
cmake_minimum_required(VERSION 3.10)
project(MocIncludeRelaxed)
include("../AutogenTest.cmake")
include("../AutogenCoreTest.cmake")
# Test moc include patterns
set(CMAKE_AUTOMOC_RELAXED_MODE TRUE)
......
cmake_minimum_required(VERSION 3.10)
project(MocIncludeStrict)
include("../AutogenTest.cmake")
include("../AutogenCoreTest.cmake")
# Test moc include patterns
set(CMAKE_AUTOMOC_RELAXED_MODE FALSE)
......
cmake_minimum_required(VERSION 3.10)
project(MocMacroName)
include("../AutogenTest.cmake")
include("../AutogenCoreTest.cmake")
# Test CMAKE_AUTOMOC_MACRO_NAMES and AUTOMOC_MACRO_NAMES
list(APPEND CMAKE_AUTOMOC_MACRO_NAMES "QO1_ALIAS")
......
cmake_minimum_required(VERSION 3.10)
project(MocOnly)
include("../AutogenTest.cmake")
include("../AutogenCoreTest.cmake")
add_executable(mocOnly
main.cpp
......
cmake_minimum_required(VERSION 3.10)
project(MocOptions)
include("../AutogenTest.cmake")
include("../AutogenCoreTest.cmake")
# Test extra options passed to moc via AUTOMOC_MOC_OPTIONS
add_executable(mocOptions Object.cpp main.cpp)
......
cmake_minimum_required(VERSION 3.11)
project(MocOsMacros)
include("../AutogenTest.cmake")
include("../AutogenCoreTest.cmake")
# Tests if moc processes Q_OS_XXX macros
......
cmake_minimum_required(VERSION 3.10)
project(MocSkipSource)
include("../AutogenTest.cmake")
include("../AutogenCoreTest.cmake")
# Test for SKIP_AUTOMOC and SKIP_AUTOGEN on an AUTOMOC enabled target
......
cmake_minimum_required(VERSION 3.10)
project(ObjectLibrary)
include("../AutogenTest.cmake")
include("../AutogenCoreTest.cmake")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
......
cmake_minimum_required(VERSION 3.10)
project(Parallel)
include("../AutogenTest.cmake")
include("../AutogenGuiTest.cmake")
# Test different values for AUTOGEN_PARALLEL
include("../Parallel/parallel.cmake")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment