diff options
Diffstat (limited to 'Tests/QtAutogen')
-rw-r--r-- | Tests/QtAutogen/CommonTests.cmake | 2 | ||||
-rw-r--r-- | Tests/QtAutogen/MocOsMacros/CMakeLists.txt | 32 |
2 files changed, 25 insertions, 9 deletions
diff --git a/Tests/QtAutogen/CommonTests.cmake b/Tests/QtAutogen/CommonTests.cmake index 55d36e6..a3f8f39 100644 --- a/Tests/QtAutogen/CommonTests.cmake +++ b/Tests/QtAutogen/CommonTests.cmake @@ -24,7 +24,7 @@ if(QT_TEST_ALLOW_QT_MACROS) ADD_AUTOGEN_TEST(MocCMP0071) endif() if(NOT QT_TEST_VERSION STREQUAL 4) - ADD_AUTOGEN_TEST(MocOsMacros mocOsMacros) + ADD_AUTOGEN_TEST(MocOsMacros) endif() ADD_AUTOGEN_TEST(UicInclude uicInclude) ADD_AUTOGEN_TEST(UicInterface QtAutoUicInterface) diff --git a/Tests/QtAutogen/MocOsMacros/CMakeLists.txt b/Tests/QtAutogen/MocOsMacros/CMakeLists.txt index 51a0ebd..e7b670e 100644 --- a/Tests/QtAutogen/MocOsMacros/CMakeLists.txt +++ b/Tests/QtAutogen/MocOsMacros/CMakeLists.txt @@ -2,15 +2,31 @@ cmake_minimum_required(VERSION 3.11) project(MocOsMacros) include("../AutogenTest.cmake") -# Tests if moc processes the macro Q_OS_MAC +# Tests if moc processes Q_OS_XXX macros -set(CMAKE_AUTOMOC True) +message( "Qt5Core_VERSION: ${Qt5Core_VERSION}" ) +message( + "CMAKE_CXX_COMPILER_PREDEFINES_COMMAND: " + ${CMAKE_CXX_COMPILER_PREDEFINES_COMMAND} ) -add_executable(mocOsMacros - main.cpp - TestClass.cpp - TestClass.hpp +# On some platforms (e.g. MAC) Q_OS_XXX requires moc to include moc_predefs.h +# which is supported since Qt 5.8 and requires +# CMAKE_CXX_COMPILER_PREDEFINES_COMMAND to be defined. +if( ( ${Qt5Core_VERSION} VERSION_GREATER_EQUAL "5.8" ) AND + DEFINED CMAKE_CXX_COMPILER_PREDEFINES_COMMAND ) -target_link_libraries(mocOsMacros PRIVATE ${QT_QTCORE_TARGET}) + message( "Test enabled!" ) + message( + "CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES: " + ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES} ) -message ( "CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES: ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}" ) + set(CMAKE_AUTOMOC True) + add_executable(mocOsMacros + main.cpp + TestClass.cpp + TestClass.hpp + ) + target_link_libraries(mocOsMacros PRIVATE ${QT_QTCORE_TARGET}) +else() + message( "Test disabled!" ) +endif() |