diff --git a/Tests/QtAutogen/CommonTests.cmake b/Tests/QtAutogen/CommonTests.cmake index 94413a3213..b03c282ec2 100644 --- a/Tests/QtAutogen/CommonTests.cmake +++ b/Tests/QtAutogen/CommonTests.cmake @@ -33,3 +33,6 @@ ADD_AUTOGEN_TEST(StaticLibraryCycle slc) ADD_AUTOGEN_TEST(Complex QtAutogen) # Rerun tests ADD_AUTOGEN_TEST(RerunMocBasic) +if(NOT QT_TEST_VERSION STREQUAL 4) + ADD_AUTOGEN_TEST(RerunMocPlugin) +endif() diff --git a/Tests/QtAutogenRerun/mocPlugin.cmake b/Tests/QtAutogen/RerunMocPlugin/CMakeLists.txt similarity index 89% rename from Tests/QtAutogenRerun/mocPlugin.cmake rename to Tests/QtAutogen/RerunMocPlugin/CMakeLists.txt index 7ad5ccb18a..076de8b044 100644 --- a/Tests/QtAutogenRerun/mocPlugin.cmake +++ b/Tests/QtAutogen/RerunMocPlugin/CMakeLists.txt @@ -1,16 +1,25 @@ +cmake_minimum_required(VERSION 3.10) +project(RerunMocPlugin) +include("../AutogenTest.cmake") + +# Tests Q_PLUGIN_METADATA and CMAKE_AUTOMOC_DEPEND_FILTERS +# json file change detection + +# Dummy executable to generate a clean target +add_executable(dummy dummy.cpp) # Utility variables set(timeformat "%Y%j%H%M%S") -set(mocPlugSrcDir "${CMAKE_CURRENT_SOURCE_DIR}/mocPlugin") -set(mocPlugBinDir "${CMAKE_CURRENT_BINARY_DIR}/mocPlugin") +set(mocPlugSrcDir "${CMAKE_CURRENT_SOURCE_DIR}/MocPlugin") +set(mocPlugBinDir "${CMAKE_CURRENT_BINARY_DIR}/MocPlugin") # Initial buid try_compile(MOC_PLUGIN "${mocPlugBinDir}" "${mocPlugSrcDir}" - mocPlugin + MocPlugin CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}" - "-DCMAKE_PREFIX_PATH=${Qt_PREFIX_DIR}" + "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" OUTPUT_VARIABLE output ) if (NOT MOC_PLUGIN) diff --git a/Tests/QtAutogenRerun/mocPlugin/CMakeLists.txt b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/CMakeLists.txt similarity index 78% rename from Tests/QtAutogenRerun/mocPlugin/CMakeLists.txt rename to Tests/QtAutogen/RerunMocPlugin/MocPlugin/CMakeLists.txt index b7cc5e9ff9..bc0085fc4b 100644 --- a/Tests/QtAutogenRerun/mocPlugin/CMakeLists.txt +++ b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/CMakeLists.txt @@ -1,19 +1,15 @@ -cmake_minimum_required(VERSION 3.9) -project(mocPlugin CXX) - -set(CMAKE_AUTOMOC_DEPEND_FILTERS - "A_CUSTOM_MACRO" - "[\n][ \t]*A_CUSTOM_MACRO[ \t\r\n]*\\([^,]+,[ \t\r\n]*\"([^\"]+)\"" - ) +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.") endif() -find_package(Qt5Widgets REQUIRED) -if(Qt5_POSITION_INDEPENDENT_CODE AND CMAKE_CXX_COMPILE_OPTIONS_PIC) - add_definitions(${CMAKE_CXX_COMPILE_OPTIONS_PIC}) -endif() +set(CMAKE_AUTOMOC_DEPEND_FILTERS + "A_CUSTOM_MACRO" + "[\n][ \t]*A_CUSTOM_MACRO[ \t\r\n]*\\([^,]+,[ \t\r\n]*\"([^\"]+)\"" +) configure_file(jsonIn/StyleC.json jsonFiles/StyleC.json) configure_file(jsonIn/StyleC.json jsonFiles/StyleC_Custom.json) @@ -22,7 +18,7 @@ configure_file(jsonIn/StyleD.json jsonFiles/sub/StyleD_Custom.json) configure_file(jsonIn/StyleE.json jsonFiles/StyleE.json) configure_file(jsonIn/StyleE.json jsonFiles/StyleE_Custom.json) -# Enable automoc +# Enable AUTOMOC set(CMAKE_AUTOMOC TRUE) include_directories("${CMAKE_CURRENT_BINARY_DIR}/jsonFiles") diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleA.cpp b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleA.cpp similarity index 100% rename from Tests/QtAutogenRerun/mocPlugin/StyleA.cpp rename to Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleA.cpp diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleA.hpp b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleA.hpp similarity index 100% rename from Tests/QtAutogenRerun/mocPlugin/StyleA.hpp rename to Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleA.hpp diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleA.json b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleA.json similarity index 100% rename from Tests/QtAutogenRerun/mocPlugin/StyleA.json rename to Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleA.json diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleA_Custom.json b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleA_Custom.json similarity index 100% rename from Tests/QtAutogenRerun/mocPlugin/StyleA_Custom.json rename to Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleA_Custom.json diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleB.cpp b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleB.cpp similarity index 100% rename from Tests/QtAutogenRerun/mocPlugin/StyleB.cpp rename to Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleB.cpp diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleB.hpp b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleB.hpp similarity index 100% rename from Tests/QtAutogenRerun/mocPlugin/StyleB.hpp rename to Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleB.hpp diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleC.cpp b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleC.cpp similarity index 100% rename from Tests/QtAutogenRerun/mocPlugin/StyleC.cpp rename to Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleC.cpp diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleC.hpp b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleC.hpp similarity index 100% rename from Tests/QtAutogenRerun/mocPlugin/StyleC.hpp rename to Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleC.hpp diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleD.cpp b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleD.cpp similarity index 100% rename from Tests/QtAutogenRerun/mocPlugin/StyleD.cpp rename to Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleD.cpp diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleD.hpp b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleD.hpp similarity index 100% rename from Tests/QtAutogenRerun/mocPlugin/StyleD.hpp rename to Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleD.hpp diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleE.cpp b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleE.cpp similarity index 100% rename from Tests/QtAutogenRerun/mocPlugin/StyleE.cpp rename to Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleE.cpp diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleE.hpp b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleE.hpp similarity index 100% rename from Tests/QtAutogenRerun/mocPlugin/StyleE.hpp rename to Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleE.hpp diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleEInclude.hpp b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleEInclude.hpp similarity index 100% rename from Tests/QtAutogenRerun/mocPlugin/StyleEInclude.hpp rename to Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleEInclude.hpp diff --git a/Tests/QtAutogenRerun/mocPlugin/UtilityMacros.hpp b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/UtilityMacros.hpp similarity index 100% rename from Tests/QtAutogenRerun/mocPlugin/UtilityMacros.hpp rename to Tests/QtAutogen/RerunMocPlugin/MocPlugin/UtilityMacros.hpp diff --git a/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleB.json b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/jsonIn/StyleB.json similarity index 100% rename from Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleB.json rename to Tests/QtAutogen/RerunMocPlugin/MocPlugin/jsonIn/StyleB.json diff --git a/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleB_Custom.json b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/jsonIn/StyleB_Custom.json similarity index 100% rename from Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleB_Custom.json rename to Tests/QtAutogen/RerunMocPlugin/MocPlugin/jsonIn/StyleB_Custom.json diff --git a/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleC.json b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/jsonIn/StyleC.json similarity index 100% rename from Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleC.json rename to Tests/QtAutogen/RerunMocPlugin/MocPlugin/jsonIn/StyleC.json diff --git a/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleD.json b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/jsonIn/StyleD.json similarity index 100% rename from Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleD.json rename to Tests/QtAutogen/RerunMocPlugin/MocPlugin/jsonIn/StyleD.json diff --git a/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleE.json b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/jsonIn/StyleE.json similarity index 100% rename from Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleE.json rename to Tests/QtAutogen/RerunMocPlugin/MocPlugin/jsonIn/StyleE.json diff --git a/Tests/QtAutogenRerun/mocPlugin/main.cpp b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/main.cpp similarity index 100% rename from Tests/QtAutogenRerun/mocPlugin/main.cpp rename to Tests/QtAutogen/RerunMocPlugin/MocPlugin/main.cpp diff --git a/Tests/QtAutogen/RerunMocPlugin/dummy.cpp b/Tests/QtAutogen/RerunMocPlugin/dummy.cpp new file mode 100644 index 0000000000..4837a76b87 --- /dev/null +++ b/Tests/QtAutogen/RerunMocPlugin/dummy.cpp @@ -0,0 +1,5 @@ + +int main(int argv, char** args) +{ + return 0; +} diff --git a/Tests/QtAutogenRerun/CMakeLists.txt b/Tests/QtAutogenRerun/CMakeLists.txt index 746ba4a421..9f1ee280c4 100644 --- a/Tests/QtAutogenRerun/CMakeLists.txt +++ b/Tests/QtAutogenRerun/CMakeLists.txt @@ -39,11 +39,5 @@ endif() # Dummy executable to generate clean target add_executable(dummy dummy.cpp) -# -- Test -# Tests Q_PLUGIN_METADATA json file change detection -if (NOT QT_TEST_VERSION STREQUAL 4) - include("mocPlugin.cmake") -endif() - # -- Test include("rccDepends.cmake")