diff options
author | Brad King <brad.king@kitware.com> | 2018-08-10 14:50:38 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2018-08-10 14:50:46 (GMT) |
commit | 0077c8c2637043b93f67ee310727542c081dc138 (patch) | |
tree | 20990e57b356dc5961d782112b93430476006b1e /Tests | |
parent | 5d995d7fdcaccc65787bffd1fa9e30e9f61581b3 (diff) | |
parent | 52676e37941ee6b31139e86ca2dfb28a80c648ae (diff) | |
download | CMake-0077c8c2637043b93f67ee310727542c081dc138.zip CMake-0077c8c2637043b93f67ee310727542c081dc138.tar.gz CMake-0077c8c2637043b93f67ee310727542c081dc138.tar.bz2 |
Merge topic 'test_MocOsMacros_fix'
52676e3794 Autogen: Tests: Use non inverting Qt version tests
e7fb85d00d Autogen: Check if we can run the MocOsMacros test
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2270
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/QtAutogen/AutogenTest.cmake | 4 | ||||
-rw-r--r-- | Tests/QtAutogen/CommonTests.cmake | 10 | ||||
-rw-r--r-- | Tests/QtAutogen/DefinesTest/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/QtAutogen/MocOsMacros/CMakeLists.txt | 32 | ||||
-rw-r--r-- | Tests/QtAutogen/RerunMocPlugin/MocPlugin/CMakeLists.txt | 4 | ||||
-rw-r--r-- | Tests/QtAutogen/SameName/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/QtAutogen/TestMacros.cmake | 2 |
7 files changed, 36 insertions, 20 deletions
diff --git a/Tests/QtAutogen/AutogenTest.cmake b/Tests/QtAutogen/AutogenTest.cmake index 8c0a14f..3969a89 100644 --- a/Tests/QtAutogen/AutogenTest.cmake +++ b/Tests/QtAutogen/AutogenTest.cmake @@ -6,7 +6,7 @@ if(QT_QMAKE_EXECUTABLE) list(APPEND CMAKE_PREFIX_PATH ${Qt_PREFIX_DIR}) endif() -if (QT_TEST_VERSION STREQUAL 4) +if (QT_TEST_VERSION EQUAL 4) find_package(Qt4 REQUIRED) include(UseQt4) @@ -21,7 +21,7 @@ if (QT_TEST_VERSION STREQUAL 4) qt4_generate_moc(${ARGN}) endmacro() -elseif(QT_TEST_VERSION STREQUAL 5) +elseif(QT_TEST_VERSION EQUAL 5) find_package(Qt5Widgets REQUIRED) set(QT_QTCORE_TARGET Qt5::Core) diff --git a/Tests/QtAutogen/CommonTests.cmake b/Tests/QtAutogen/CommonTests.cmake index 55d36e6..01ed7e9 100644 --- a/Tests/QtAutogen/CommonTests.cmake +++ b/Tests/QtAutogen/CommonTests.cmake @@ -12,7 +12,7 @@ if(QT_TEST_ALLOW_QT_MACROS) endif() ADD_AUTOGEN_TEST(UicSkipSource) ADD_AUTOGEN_TEST(RccSkipSource) -if(NOT QT_TEST_VERSION STREQUAL 4) +if(QT_TEST_VERSION GREATER 4) ADD_AUTOGEN_TEST(MocMacroName mocMacroName) endif() ADD_AUTOGEN_TEST(MocDepends) @@ -23,13 +23,13 @@ endif() if(QT_TEST_ALLOW_QT_MACROS) ADD_AUTOGEN_TEST(MocCMP0071) endif() -if(NOT QT_TEST_VERSION STREQUAL 4) - ADD_AUTOGEN_TEST(MocOsMacros mocOsMacros) +if(QT_TEST_VERSION GREATER 4) + ADD_AUTOGEN_TEST(MocOsMacros) endif() ADD_AUTOGEN_TEST(UicInclude uicInclude) ADD_AUTOGEN_TEST(UicInterface QtAutoUicInterface) ADD_AUTOGEN_TEST(ObjectLibrary someProgram) -if(APPLE AND (NOT QT_TEST_VERSION STREQUAL 4)) +if(APPLE AND (QT_TEST_VERSION GREATER 4)) ADD_AUTOGEN_TEST(MacOsFW) endif() ADD_AUTOGEN_TEST(Parallel parallel) @@ -42,7 +42,7 @@ ADD_AUTOGEN_TEST(SameName sameName) ADD_AUTOGEN_TEST(StaticLibraryCycle slc) # Rerun tests ADD_AUTOGEN_TEST(RerunMocBasic) -if(NOT QT_TEST_VERSION STREQUAL 4) +if(QT_TEST_VERSION GREATER 4) ADD_AUTOGEN_TEST(RerunMocPlugin) endif() ADD_AUTOGEN_TEST(RerunRccDepends) diff --git a/Tests/QtAutogen/DefinesTest/CMakeLists.txt b/Tests/QtAutogen/DefinesTest/CMakeLists.txt index de22845..3761dd8 100644 --- a/Tests/QtAutogen/DefinesTest/CMakeLists.txt +++ b/Tests/QtAutogen/DefinesTest/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.10) project(DefinesTest) # Qt4 only definitions test -if(NOT QT_TEST_VERSION STREQUAL 4) +if(NOT QT_TEST_VERSION EQUAL 4) message(ERROR "Invalid Qt test version. This test is for Qt4 only.") endif() 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() diff --git a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/CMakeLists.txt b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/CMakeLists.txt index bc0085f..ca22aeb 100644 --- a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/CMakeLists.txt +++ b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/CMakeLists.txt @@ -2,8 +2,8 @@ cmake_minimum_required(VERSION 3.10) project(MocPlugin) include("../../AutogenTest.cmake") -if (NOT QT_TEST_VERSION STREQUAL 5) - message(SEND_ERROR "Invalid Qt version specified.") +if (QT_TEST_VERSION LESS 5) + message(SEND_ERROR "Qt 5 or higher required.") endif() set(CMAKE_AUTOMOC_DEPEND_FILTERS diff --git a/Tests/QtAutogen/SameName/CMakeLists.txt b/Tests/QtAutogen/SameName/CMakeLists.txt index c7d6e52..931e40f 100644 --- a/Tests/QtAutogen/SameName/CMakeLists.txt +++ b/Tests/QtAutogen/SameName/CMakeLists.txt @@ -28,7 +28,7 @@ set_target_properties(sameName PROPERTIES ) # Set different compression levels -if (QT_TEST_VERSION STREQUAL 4) +if (QT_TEST_VERSION EQUAL 4) set(rccCompress "-compress") else() set(rccCompress "--compress") diff --git a/Tests/QtAutogen/TestMacros.cmake b/Tests/QtAutogen/TestMacros.cmake index 8e4bea2..0e27188 100644 --- a/Tests/QtAutogen/TestMacros.cmake +++ b/Tests/QtAutogen/TestMacros.cmake @@ -50,7 +50,7 @@ if(NON_ASCII_BDIR) # Qt4 moc does not support utf8 paths in _parameter files generated by # qtx_wrap_cpp # https://bugreports.qt.io/browse/QTBUG-35480 - if(QT_TEST_VERSION STREQUAL 4) + if(QT_TEST_VERSION EQUAL 4) set(QT_TEST_ALLOW_QT_MACROS FALSE) endif() # On windows qtx_wrap_cpp also fails in Qt5 when used on a path that |