summaryrefslogtreecommitdiff
path: root/Tests/QtAutogen
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/QtAutogen')
-rw-r--r--Tests/QtAutogen/CMakeLists.txt330
-rw-r--r--Tests/QtAutogen/complex/CMakeLists.txt2
-rw-r--r--Tests/QtAutogen/mocCMP0071/CMakeLists.txt4
-rw-r--r--Tests/QtAutogen/mocCMP0071/NEW/CMakeLists.txt16
-rw-r--r--Tests/QtAutogen/mocCMP0071/OLD/CMakeLists.txt18
-rw-r--r--Tests/QtAutogen/mocCMP0071/Obj.cpp20
-rw-r--r--Tests/QtAutogen/mocCMP0071/Obj.hpp19
-rw-r--r--Tests/QtAutogen/mocCMP0071/Obj_p.h14
-rw-r--r--Tests/QtAutogen/mocCMP0071/main.cpp (renamed from Tests/QtAutogen/mocPlugin/main.cpp)3
-rw-r--r--Tests/QtAutogen/mocDepends/CMakeLists.txt2
-rw-r--r--Tests/QtAutogen/mocInclude/EObjA.cpp43
-rw-r--r--Tests/QtAutogen/mocInclude/EObjA.hpp19
-rw-r--r--Tests/QtAutogen/mocInclude/EObjAExtra.cpp20
-rw-r--r--Tests/QtAutogen/mocInclude/EObjAExtra.hpp18
-rw-r--r--Tests/QtAutogen/mocInclude/EObjAExtra_p.hpp12
-rw-r--r--Tests/QtAutogen/mocInclude/EObjA_p.hpp12
-rw-r--r--Tests/QtAutogen/mocInclude/EObjB.cpp44
-rw-r--r--Tests/QtAutogen/mocInclude/EObjB.hpp19
-rw-r--r--Tests/QtAutogen/mocInclude/EObjB_p.hpp12
-rw-r--r--Tests/QtAutogen/mocInclude/LObjA.cpp39
-rw-r--r--Tests/QtAutogen/mocInclude/LObjA.hpp19
-rw-r--r--Tests/QtAutogen/mocInclude/LObjA_p.h12
-rw-r--r--Tests/QtAutogen/mocInclude/LObjB.cpp40
-rw-r--r--Tests/QtAutogen/mocInclude/LObjB.hpp19
-rw-r--r--Tests/QtAutogen/mocInclude/LObjB_p.h12
-rw-r--r--Tests/QtAutogen/mocInclude/ObjA.cpp24
-rw-r--r--Tests/QtAutogen/mocInclude/ObjA.hpp10
-rw-r--r--Tests/QtAutogen/mocInclude/ObjA_p.h12
-rw-r--r--Tests/QtAutogen/mocInclude/ObjB.cpp23
-rw-r--r--Tests/QtAutogen/mocInclude/ObjB.hpp14
-rw-r--r--Tests/QtAutogen/mocInclude/ObjB_p.h12
-rw-r--r--Tests/QtAutogen/mocInclude/ObjC.cpp26
-rw-r--r--Tests/QtAutogen/mocInclude/ObjC.hpp13
-rw-r--r--Tests/QtAutogen/mocInclude/ObjD.cpp26
-rw-r--r--Tests/QtAutogen/mocInclude/ObjD.hpp13
-rw-r--r--Tests/QtAutogen/mocInclude/SObjA.cpp11
-rw-r--r--Tests/QtAutogen/mocInclude/SObjA.hpp15
-rw-r--r--Tests/QtAutogen/mocInclude/SObjB.cpp.in11
-rw-r--r--Tests/QtAutogen/mocInclude/SObjB.hpp.in15
-rw-r--r--Tests/QtAutogen/mocInclude/SObjC.cpp35
-rw-r--r--Tests/QtAutogen/mocInclude/SObjC.hpp15
-rw-r--r--Tests/QtAutogen/mocInclude/SObjCExtra.cpp31
-rw-r--r--Tests/QtAutogen/mocInclude/SObjCExtra.hpp15
-rw-r--r--Tests/QtAutogen/mocInclude/SObjCExtra.moc.in4
-rw-r--r--Tests/QtAutogen/mocInclude/shared.cmake71
-rw-r--r--Tests/QtAutogen/mocInclude/subA/SubObjA.cpp27
-rw-r--r--Tests/QtAutogen/mocInclude/subA/SubObjA.hpp16
-rw-r--r--Tests/QtAutogen/mocInclude/subB/SubObjB.cpp27
-rw-r--r--Tests/QtAutogen/mocInclude/subB/SubObjB.hpp16
-rw-r--r--Tests/QtAutogen/mocInclude/subC/SubObjC.cpp27
-rw-r--r--Tests/QtAutogen/mocInclude/subC/SubObjC.hpp16
-rw-r--r--Tests/QtAutogen/mocInclude/subExtra/EObjBExtra.cpp20
-rw-r--r--Tests/QtAutogen/mocInclude/subExtra/EObjBExtra.hpp18
-rw-r--r--Tests/QtAutogen/mocInclude/subExtra/EObjBExtra_p.hpp12
-rw-r--r--Tests/QtAutogen/mocInclude/subGlobal/GObj.cpp41
-rw-r--r--Tests/QtAutogen/mocInclude/subGlobal/GObj.hpp17
-rw-r--r--Tests/QtAutogen/mocInclude/subGlobal/GObj_p.hpp15
-rw-r--r--Tests/QtAutogen/mocIncludeRelaxed/CMakeLists.txt23
-rw-r--r--Tests/QtAutogen/mocIncludeRelaxed/RMain.cpp12
-rw-r--r--Tests/QtAutogen/mocIncludeRelaxed/RObjA.cpp12
-rw-r--r--Tests/QtAutogen/mocIncludeRelaxed/RObjA.hpp14
-rw-r--r--Tests/QtAutogen/mocIncludeRelaxed/RObjB.cpp22
-rw-r--r--Tests/QtAutogen/mocIncludeRelaxed/RObjB.hpp14
-rw-r--r--Tests/QtAutogen/mocIncludeRelaxed/RObjBExtra.hpp14
-rw-r--r--Tests/QtAutogen/mocIncludeRelaxed/RObjC.cpp30
-rw-r--r--Tests/QtAutogen/mocIncludeRelaxed/RObjC.hpp14
-rw-r--r--Tests/QtAutogen/mocIncludeRelaxed/main.cpp18
-rw-r--r--Tests/QtAutogen/mocIncludeStrict/CMakeLists.txt16
-rw-r--r--Tests/QtAutogen/mocIncludeStrict/main.cpp18
-rw-r--r--Tests/QtAutogen/mocMacroName/CMakeLists.txt8
-rw-r--r--Tests/QtAutogen/mocMacroName/CustomMacros.hpp8
-rw-r--r--Tests/QtAutogen/mocMacroName/Gadget.cpp6
-rw-r--r--Tests/QtAutogen/mocMacroName/Gadget.hpp15
-rw-r--r--Tests/QtAutogen/mocMacroName/Object.cpp9
-rw-r--r--Tests/QtAutogen/mocMacroName/Object.hpp19
-rw-r--r--Tests/QtAutogen/mocMacroName/Object1Aliased.cpp9
-rw-r--r--Tests/QtAutogen/mocMacroName/Object1Aliased.hpp20
-rw-r--r--Tests/QtAutogen/mocMacroName/Object2Aliased.cpp9
-rw-r--r--Tests/QtAutogen/mocMacroName/Object2Aliased.hpp20
-rw-r--r--Tests/QtAutogen/mocMacroName/main.cpp13
-rw-r--r--Tests/QtAutogen/mocOnlySource/StyleA.cpp5
-rw-r--r--Tests/QtAutogen/mocOnlySource/StyleA.hpp15
-rw-r--r--Tests/QtAutogen/mocOnlySource/StyleB.cpp5
-rw-r--r--Tests/QtAutogen/mocOnlySource/StyleB.hpp16
-rw-r--r--Tests/QtAutogen/mocOnlySource/main.cpp9
-rw-r--r--Tests/QtAutogen/mocPlugin/CMakeLists.txt33
-rw-r--r--Tests/QtAutogen/mocPlugin/StyleA.cpp6
-rw-r--r--Tests/QtAutogen/mocPlugin/StyleA.hpp17
-rw-r--r--Tests/QtAutogen/mocPlugin/StyleA.json1
-rw-r--r--Tests/QtAutogen/mocPlugin/StyleA_Custom.json1
-rw-r--r--Tests/QtAutogen/mocPlugin/StyleB.cpp6
-rw-r--r--Tests/QtAutogen/mocPlugin/StyleB.hpp17
-rw-r--r--Tests/QtAutogen/mocPlugin/StyleC.cpp6
-rw-r--r--Tests/QtAutogen/mocPlugin/StyleC.hpp17
-rw-r--r--Tests/QtAutogen/mocPlugin/StyleCommon.hpp7
-rw-r--r--Tests/QtAutogen/mocPlugin/StyleD.cpp6
-rw-r--r--Tests/QtAutogen/mocPlugin/StyleD.hpp17
-rw-r--r--Tests/QtAutogen/mocPlugin/StyleE.cpp6
-rw-r--r--Tests/QtAutogen/mocPlugin/StyleE.hpp17
-rw-r--r--Tests/QtAutogen/mocPlugin/jsonIn/StyleB.json1
-rw-r--r--Tests/QtAutogen/mocPlugin/jsonIn/StyleB_Custom.json1
-rw-r--r--Tests/QtAutogen/mocPlugin/jsonIn/StyleC.json1
-rw-r--r--Tests/QtAutogen/mocPlugin/jsonIn/StyleD.json1
-rw-r--r--Tests/QtAutogen/mocRerun/CMakeLists.txt35
-rw-r--r--Tests/QtAutogen/mocRerun/input.txt1
-rw-r--r--Tests/QtAutogen/mocRerun/main.cpp.in18
-rw-r--r--Tests/QtAutogen/mocRerun/res1.qrc5
-rw-r--r--Tests/QtAutogen/mocRerun/test1a.h.in8
-rw-r--r--Tests/QtAutogen/mocRerun/test1b.h.in7
-rw-r--r--Tests/QtAutogen/objectLibrary/CMakeLists.txt14
-rw-r--r--Tests/QtAutogen/objectLibrary/a/CMakeLists.txt2
-rw-r--r--Tests/QtAutogen/objectLibrary/a/classa.cpp7
-rw-r--r--Tests/QtAutogen/objectLibrary/a/classa.h23
-rw-r--r--Tests/QtAutogen/objectLibrary/b/classb.cpp7
-rw-r--r--Tests/QtAutogen/objectLibrary/b/classb.h23
-rw-r--r--Tests/QtAutogen/objectLibrary/main.cpp13
-rw-r--r--Tests/QtAutogen/rccDepends/CMakeLists.txt35
-rw-r--r--Tests/QtAutogen/rccDepends/main.cpp5
-rw-r--r--Tests/QtAutogen/rccDepends/res/input1.txt.in1
-rw-r--r--Tests/QtAutogen/rccDepends/res/input2.txt.in1
-rw-r--r--Tests/QtAutogen/rccDepends/res1a.qrc.in5
-rw-r--r--Tests/QtAutogen/rccDepends/res1b.qrc.in6
-rw-r--r--Tests/QtAutogen/rccDepends/res2a.qrc.in5
-rw-r--r--Tests/QtAutogen/rccDepends/res2b.qrc.in6
-rw-r--r--Tests/QtAutogen/sameName/CMakeLists.txt5
-rw-r--r--Tests/QtAutogen/sameName/aaa/bbb/item.cpp12
-rw-r--r--Tests/QtAutogen/sameName/aaa/item.cpp14
-rw-r--r--Tests/QtAutogen/sameName/aaa/item.hpp2
-rw-r--r--Tests/QtAutogen/sameName/aaa/view.ui24
-rw-r--r--Tests/QtAutogen/sameName/bbb/aaa/item.cpp12
-rw-r--r--Tests/QtAutogen/sameName/bbb/item.cpp15
-rw-r--r--Tests/QtAutogen/sameName/bbb/item.hpp1
-rw-r--r--Tests/QtAutogen/sameName/bbb/view.ui24
-rw-r--r--Tests/QtAutogen/sameName/ccc/item.cpp20
-rw-r--r--Tests/QtAutogen/sameName/ccc/item.hpp2
-rw-r--r--Tests/QtAutogen/sameName/ccc/view.ui24
-rw-r--r--Tests/QtAutogen/sameName/item.cpp15
-rw-r--r--Tests/QtAutogen/sameName/item.hpp2
-rw-r--r--Tests/QtAutogen/sameName/view.ui24
-rw-r--r--Tests/QtAutogen/skipMoc.cpp6
-rw-r--r--Tests/QtAutogen/skipSource/qItemC.cpp12
-rw-r--r--Tests/QtAutogen/skipSource/qItemD.cpp17
-rw-r--r--Tests/QtAutogen/skipSource/qItemD.hpp13
-rw-r--r--Tests/QtAutogen/staticLibraryCycle/CMakeLists.txt17
-rw-r--r--Tests/QtAutogen/staticLibraryCycle/a.cpp7
-rw-r--r--Tests/QtAutogen/staticLibraryCycle/a.h13
-rw-r--r--Tests/QtAutogen/staticLibraryCycle/b.cpp7
-rw-r--r--Tests/QtAutogen/staticLibraryCycle/b.h13
-rw-r--r--Tests/QtAutogen/staticLibraryCycle/c.cpp7
-rw-r--r--Tests/QtAutogen/staticLibraryCycle/c.h13
-rw-r--r--Tests/QtAutogen/staticLibraryCycle/main.cpp8
151 files changed, 1706 insertions, 820 deletions
diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt
index 073c5fdef..32c2950cb 100644
--- a/Tests/QtAutogen/CMakeLists.txt
+++ b/Tests/QtAutogen/CMakeLists.txt
@@ -1,14 +1,7 @@
-cmake_minimum_required(VERSION 3.7)
-
+cmake_minimum_required(VERSION 3.9)
+cmake_policy(SET CMP0071 NEW)
project(QtAutogen)
-# 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)
- set(CMAKE_PREFIX_PATH ${Qt_PREFIX_DIR})
-endif()
-
if (QT_TEST_VERSION STREQUAL 4)
find_package(Qt4 REQUIRED)
@@ -22,6 +15,9 @@ if (QT_TEST_VERSION STREQUAL 4)
macro(qtx_wrap_cpp)
qt4_wrap_cpp(${ARGN})
endmacro()
+ macro(qtx_generate_moc)
+ qt4_generate_moc(${ARGN})
+ endmacro()
else()
if (NOT QT_TEST_VERSION STREQUAL 5)
@@ -41,11 +37,48 @@ else()
macro(qtx_wrap_cpp)
qt5_wrap_cpp(${ARGN})
endmacro()
+ macro(qtx_generate_moc)
+ qt5_generate_moc(${ARGN})
+ endmacro()
endif()
get_property(QT_COMPILE_FEATURES TARGET ${QT_QTCORE_TARGET} PROPERTY INTERFACE_COMPILE_FEATURES)
+# Qt4 moc does not support utf8 paths in _parameter files generated by
+# qtx_wrap_cpp
+# https://bugreports.qt.io/browse/QTBUG-35480
+# Do a simple check if there is are non ASCII character in the build path
+string(REGEX MATCH "[^ -~]+" NON_ASCII_BDIR ${CMAKE_CURRENT_BINARY_DIR})
+if((NOT NON_ASCII_BDIR) OR (NOT QT_TEST_VERSION STREQUAL 4))
+ set(ALLOW_WRAP_CPP TRUE)
+endif()
+# On windows qtx_wrap_cpp also fails in Qt5 when used on a path that
+# contains non ASCII characters
+if(NON_ASCII_BDIR AND WIN32)
+ set(ALLOW_WRAP_CPP FALSE)
+endif()
+
+# -- Test
+# MOC only
+add_executable(mocOnly mocOnlySource/main.cpp mocOnlySource/StyleA.cpp mocOnlySource/StyleB.cpp)
+set_property(TARGET mocOnly PROPERTY AUTOMOC ON)
+target_link_libraries(mocOnly ${QT_LIBRARIES})
+
+add_executable(mocOnlyOpts mocOnlySource/main.cpp mocOnlySource/StyleA.cpp mocOnlySource/StyleB.cpp)
+set_property(TARGET mocOnlyOpts PROPERTY AUTOMOC ON)
+set_property(TARGET mocOnlyOpts PROPERTY AUTOMOC_MOC_OPTIONS "-nw")
+target_link_libraries(mocOnlyOpts ${QT_LIBRARIES})
+
+# -- Test
+# UIC only
+if(ALLOW_WRAP_CPP)
+ qtx_wrap_cpp(uicOnlyMoc uicOnlySource/uiconly.h)
+ add_executable(uicOnly uicOnlySource/uiconly.cpp ${uicOnlyMoc})
+ set_property(TARGET uicOnly PROPERTY AUTOUIC ON)
+ target_link_libraries(uicOnly ${QT_LIBRARIES})
+endif()
+
# -- Test
# RCC only
add_executable(rccOnly rccOnly.cpp rccOnlyRes.qrc)
@@ -59,13 +92,6 @@ set_property(TARGET rccEmpty PROPERTY AUTORCC ON)
target_link_libraries(rccEmpty ${QT_QTCORE_TARGET})
# -- Test
-# UIC only
-qtx_wrap_cpp(uicOnlyMoc uicOnlySource/uiconly.h)
-add_executable(uicOnly uicOnlySource/uiconly.cpp ${uicOnlyMoc})
-set_property(TARGET uicOnly PROPERTY AUTOUIC ON)
-target_link_libraries(uicOnly ${QT_LIBRARIES})
-
-# -- Test
# Add not_generated_file.qrc to the source list to get the file-level
# dependency, but don't generate a c++ file from it. Disable the AUTORCC
# feature for this target. This tests that qrc files in the sources don't
@@ -80,154 +106,41 @@ set_target_properties(no_link_language PROPERTIES AUTOMOC TRUE)
target_compile_features(no_link_language PRIVATE ${QT_COMPILE_FEATURES})
target_compile_features(empty PRIVATE ${QT_COMPILE_FEATURES})
-# -- Test
-# When a file listed in a .qrc file changes the target must be rebuilt
-set(timeformat "%Y%j%H%M%S")
-set(RCC_DEPENDS_SRC "${CMAKE_CURRENT_SOURCE_DIR}/rccDepends")
-set(RCC_DEPENDS_BIN "${CMAKE_CURRENT_BINARY_DIR}/rccDepends")
-configure_file(${RCC_DEPENDS_SRC}/res1a.qrc.in ${RCC_DEPENDS_BIN}/res1.qrc COPYONLY)
-configure_file(${RCC_DEPENDS_SRC}/res2a.qrc.in ${RCC_DEPENDS_BIN}/res2.qrc.in COPYONLY)
-try_compile(RCC_DEPENDS
- "${RCC_DEPENDS_BIN}"
- "${RCC_DEPENDS_SRC}"
- rccDepends
- CMAKE_FLAGS "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
- "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
- "-DCMAKE_PREFIX_PATH=${Qt_PREFIX_DIR}"
- OUTPUT_VARIABLE output
-)
-if (NOT RCC_DEPENDS)
- message(SEND_ERROR "Initial build of rccDepends failed. Output: ${output}")
-endif()
-# Get name and timestamp of the output binary
-file(STRINGS "${RCC_DEPENDS_BIN}/target.txt" targetList)
-list(GET targetList 0 rccDependsBin)
-file(TIMESTAMP "${rccDependsBin}" timeBegin "${timeformat}")
-# Sleep, touch regular qrc input file, rebuild and compare timestamp
-execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) # Ensure that the timestamp will change.
-execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${RCC_DEPENDS_BIN}/res1/input.txt")
-execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${RCC_DEPENDS_BIN}" RESULT_VARIABLE result)
-if (result)
- message(SEND_ERROR "Second build of rccDepends failed.")
-endif()
-file(TIMESTAMP "${rccDependsBin}" timeStep1 "${timeformat}")
-if (NOT timeStep1 GREATER timeBegin)
- message(SEND_ERROR "File (${rccDependsBin}) should have changed in the first step!")
-endif()
-# Sleep, update regular qrc file, rebuild and compare timestamp
-execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) # Ensure that the timestamp will change.
-configure_file(${RCC_DEPENDS_SRC}/res1b.qrc.in ${RCC_DEPENDS_BIN}/res1.qrc COPYONLY)
-execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${RCC_DEPENDS_BIN}" RESULT_VARIABLE result)
-if (result)
- message(SEND_ERROR "Third build of rccDepends failed.")
-endif()
-file(TIMESTAMP "${rccDependsBin}" timeStep2 "${timeformat}")
-if (NOT timeStep2 GREATER timeStep1)
- message(SEND_ERROR "File (${rccDependsBin}) should have changed in the second step!")
-endif()
-# Sleep, touch regular qrc newly added input file, rebuild and compare timestamp
-execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) # Ensure that the timestamp will change.
-execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${RCC_DEPENDS_BIN}/res1/inputAdded.txt")
-execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${RCC_DEPENDS_BIN}" RESULT_VARIABLE result)
-if (result)
- message(SEND_ERROR "Fourth build of rccDepends failed.")
-endif()
-file(TIMESTAMP "${rccDependsBin}" timeStep3 "${timeformat}")
-if (NOT timeStep3 GREATER timeStep2)
- message(SEND_ERROR "File (${rccDependsBin}) should have changed in the third step!")
-endif()
-# Sleep, touch generated qrc input file, rebuild and compare timestamp
-execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) # Ensure that the timestamp will change.
-execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${RCC_DEPENDS_BIN}/res2/input.txt")
-execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${RCC_DEPENDS_BIN}" RESULT_VARIABLE result)
-if (result)
- message(SEND_ERROR "Fifth build of rccDepends failed.")
-endif()
-file(TIMESTAMP "${rccDependsBin}" timeStep4 "${timeformat}")
-if (NOT timeStep4 GREATER timeStep3)
- message(SEND_ERROR "File (${rccDependsBin}) should have changed in the fourth step!")
-endif()
-# Sleep, update generated qrc file, rebuild and compare timestamp
-execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) # Ensure that the timestamp will change.
-configure_file(${RCC_DEPENDS_SRC}/res2b.qrc.in ${RCC_DEPENDS_BIN}/res2.qrc.in COPYONLY)
-execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${RCC_DEPENDS_BIN}" RESULT_VARIABLE result)
-if (result)
- message(SEND_ERROR "Sixth build of rccDepends failed.")
-endif()
-file(TIMESTAMP "${rccDependsBin}" timeStep5 "${timeformat}")
-if (NOT timeStep5 GREATER timeStep4)
- message(SEND_ERROR "File (${rccDependsBin}) should have changed in the fitfh step!")
-endif()
-# Sleep, touch generated qrc newly added input file, rebuild and compare timestamp
-execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) # Ensure that the timestamp will change.
-execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${RCC_DEPENDS_BIN}/res2/inputAdded.txt")
-execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${RCC_DEPENDS_BIN}" RESULT_VARIABLE result)
-if (result)
- message(SEND_ERROR "Seventh build of rccDepends failed.")
-endif()
-file(TIMESTAMP "${rccDependsBin}" timeStep6 "${timeformat}")
-if (NOT timeStep6 GREATER timeStep5)
- message(SEND_ERROR "File (${rccDependsBin}) should have changed in the sixth step!")
-endif()
-
-
-# -- Test
-# Ensure a repeated build succeeds when a header containing a QObject changes
-set(timeformat "%Y%j%H%M%S")
-configure_file(mocRerun/test1a.h.in mocRerun/test1.h COPYONLY)
-try_compile(MOC_RERUN
- "${CMAKE_CURRENT_BINARY_DIR}/mocRerun"
- "${CMAKE_CURRENT_SOURCE_DIR}/mocRerun"
- mocRerun
- CMAKE_FLAGS "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
- "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
- "-DCMAKE_PREFIX_PATH=${Qt_PREFIX_DIR}"
- OUTPUT_VARIABLE output
-)
-if (NOT MOC_RERUN)
- message(SEND_ERROR "Initial build of mocRerun failed. Output: ${output}")
-endif()
-# Get name and timestamp of the output binary
-file(STRINGS "${CMAKE_CURRENT_BINARY_DIR}/mocRerun/target1.txt" target1List)
-list(GET target1List 0 binFile)
-file(TIMESTAMP "${binFile}" timeBegin "${timeformat}")
-# Change file content and rebuild
-execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
-configure_file(mocRerun/test1b.h.in mocRerun/test1.h COPYONLY)
-execute_process(COMMAND "${CMAKE_COMMAND}" --build .
- WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/mocRerun"
- RESULT_VARIABLE mocRerun_result
- )
-if (mocRerun_result)
- message(SEND_ERROR "Second build of mocRerun failed.")
-endif()
-# Compare timestamps
-file(TIMESTAMP "${binFile}" timeStep1 "${timeformat}")
-if (NOT timeStep1 GREATER timeBegin)
- message(SEND_ERROR "File (${binFile}) should have changed in the first step!")
-endif()
# -- Test
# Test for SKIP_AUTOMOC and SKIP_AUTOGEN on an AUTOMOC enabled target
-qtx_wrap_cpp(skipMocWrapMoc
- skipSource/qItemA.hpp
- skipSource/qItemB.hpp)
-set(skipMocSources
- skipMoc.cpp
- skipSource/qItemA.cpp
- skipSource/qItemB.cpp
- skipSource/qItemC.cpp)
-set_property(SOURCE skipSource/qItemA.cpp PROPERTY SKIP_AUTOMOC ON)
-set_property(SOURCE skipSource/qItemB.cpp PROPERTY SKIP_AUTOGEN ON)
-# AUTOMOC enabled only
-add_executable(skipMocA ${skipMocSources} ${skipMocWrapMoc})
-set_property(TARGET skipMocA PROPERTY AUTOMOC ON)
-target_link_libraries(skipMocA ${QT_LIBRARIES})
-# AUTOMOC and AUTOUIC enabled
-add_executable(skipMocB ${skipMocSources} ${skipMocWrapMoc})
-set_property(TARGET skipMocB PROPERTY AUTOMOC ON)
-set_property(TARGET skipMocB PROPERTY AUTOUIC ON)
-target_link_libraries(skipMocB ${QT_LIBRARIES})
+if(ALLOW_WRAP_CPP)
+ # Generate header mocs manually
+ qtx_wrap_cpp(skipMocWrapMoc
+ skipSource/qItemA.hpp
+ skipSource/qItemB.hpp
+ skipSource/qItemC.hpp
+ skipSource/qItemD.hpp
+ )
+ set(skipMocSources
+ skipMoc.cpp
+ skipSource/qItemA.cpp
+ skipSource/qItemB.cpp
+ skipSource/qItemC.cpp
+ skipSource/qItemD.cpp
+ )
+ # When cpp files are skipped, the hpp won't be processed either,
+ # unless they are mentioned in the sources - which they aren't.
+ set_property(SOURCE skipSource/qItemA.cpp PROPERTY SKIP_AUTOMOC ON)
+ set_property(SOURCE skipSource/qItemB.cpp PROPERTY SKIP_AUTOGEN ON)
+ # When hpp files are skipped, the cpp still get processed.
+ set_property(SOURCE skipSource/qItemC.hpp PROPERTY SKIP_AUTOMOC ON)
+ set_property(SOURCE skipSource/qItemD.hpp PROPERTY SKIP_AUTOGEN ON)
+ # AUTOMOC enabled only
+ add_executable(skipMocA ${skipMocSources} ${skipMocWrapMoc})
+ set_property(TARGET skipMocA PROPERTY AUTOMOC ON)
+ target_link_libraries(skipMocA ${QT_LIBRARIES})
+ # AUTOMOC and AUTOUIC enabled
+ add_executable(skipMocB ${skipMocSources} ${skipMocWrapMoc})
+ set_property(TARGET skipMocB PROPERTY AUTOMOC ON)
+ set_property(TARGET skipMocB PROPERTY AUTOUIC ON)
+ target_link_libraries(skipMocB ${QT_LIBRARIES})
+endif()
# -- Test
# Test for SKIP_AUTOUIC and SKIP_AUTOGEN on an AUTOUIC enabled target
@@ -271,8 +184,10 @@ set_property(TARGET skipRccB PROPERTY AUTOMOC ON)
target_link_libraries(skipRccB ${QT_LIBRARIES})
# -- Test
-# Source files with the same basename in different subdirectories
-add_subdirectory(sameName)
+# MOC AUTOMOC_MACRO_NAMES
+if (NOT QT_TEST_VERSION STREQUAL 4)
+ add_subdirectory(mocMacroName)
+endif()
# -- Test
# Tests AUTOMOC with generated sources
@@ -280,85 +195,32 @@ add_subdirectory(mocDepends)
# -- Test
# Tests various include moc patterns
-add_subdirectory(mocIncludeStrict)
+if(ALLOW_WRAP_CPP)
+ add_subdirectory(mocIncludeStrict)
+ add_subdirectory(mocIncludeRelaxed)
+endif()
# -- Test
-# Tests various include moc patterns
-add_subdirectory(mocIncludeRelaxed)
+# Tests policy 0071
+if(ALLOW_WRAP_CPP)
+ add_subdirectory(mocCMP0071)
+endif()
# -- Test
-# Tests Q_PLUGIN_METADATA json file change detection
-if (NOT QT_TEST_VERSION STREQUAL 4)
- try_compile(MOC_PLUGIN
- "${CMAKE_CURRENT_BINARY_DIR}/mocPlugin"
- "${CMAKE_CURRENT_SOURCE_DIR}/mocPlugin"
- mocPlugin
- CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
- "-DCMAKE_PREFIX_PATH=${Qt_PREFIX_DIR}"
- OUTPUT_VARIABLE output
- )
- if (NOT MOC_PLUGIN)
- message(SEND_ERROR "Initial build of mocPlugin failed. Output: ${output}")
- endif()
-
- set(timeformat "%Y%j%H%M%S")
- set(mocPlugSrcDir "${CMAKE_CURRENT_SOURCE_DIR}/mocPlugin")
- set(mocPlugBinDir "${CMAKE_CURRENT_BINARY_DIR}/mocPlugin")
- find_library(plAFile "PlugA" PATHS "${mocPlugBinDir}/Debug" "${mocPlugBinDir}" NO_DEFAULT_PATH)
- find_library(plBFile "PlugB" PATHS "${mocPlugBinDir}/Debug" "${mocPlugBinDir}" NO_DEFAULT_PATH)
- find_library(plCFile "PlugC" PATHS "${mocPlugBinDir}/Debug" "${mocPlugBinDir}" NO_DEFAULT_PATH)
- find_library(plDFile "PlugD" PATHS "${mocPlugBinDir}/Debug" "${mocPlugBinDir}" NO_DEFAULT_PATH)
-
- file(TIMESTAMP "${plAFile}" plABefore "${timeformat}")
- file(TIMESTAMP "${plBFile}" plBBefore "${timeformat}")
- file(TIMESTAMP "${plCFile}" plCBefore "${timeformat}")
- file(TIMESTAMP "${plDFile}" plDBefore "${timeformat}")
-
- # Ensure that the timestamp will change and change the json files
- execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
- configure_file("${mocPlugSrcDir}/jsonIn/StyleD.json" "${mocPlugBinDir}/jsonFiles/StyleC.json")
- configure_file("${mocPlugSrcDir}/jsonIn/StyleC.json" "${mocPlugBinDir}/jsonFiles/sub/StyleD.json")
- execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${mocPlugBinDir}")
-
- file(TIMESTAMP "${plAFile}" plAAfter "${timeformat}")
- file(TIMESTAMP "${plBFile}" plBAfter "${timeformat}")
- file(TIMESTAMP "${plCFile}" plCAfter "${timeformat}")
- file(TIMESTAMP "${plDFile}" plDAfter "${timeformat}")
-
- if (plAAfter GREATER plABefore)
- message(SEND_ERROR "file (${plAFile}) should not have changed!")
- endif()
- if (plBAfter GREATER plBBefore)
- message(SEND_ERROR "file (${plBFile}) should not have changed!")
- endif()
- if (NOT plCAfter GREATER plCBefore)
- message(SEND_ERROR "file (${plCFile}) should have changed!")
- endif()
- if (NOT plDAfter GREATER plDBefore)
- message(SEND_ERROR "file (${plDFile}) should have changed!")
- endif()
+# Tests various .ui include directories
+add_subdirectory(uicInclude)
- # Test custom macro
- file(TIMESTAMP "${plCFile}" plCBefore "${timeformat}")
- file(TIMESTAMP "${plDFile}" plDBefore "${timeformat}")
- execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
- configure_file("${mocPlugSrcDir}/jsonIn/StyleD.json" "${mocPlugBinDir}/jsonFiles/StyleC_Custom.json")
- configure_file("${mocPlugSrcDir}/jsonIn/StyleC.json" "${mocPlugBinDir}/jsonFiles/sub/StyleD_Custom.json")
- execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${mocPlugBinDir}")
- file(TIMESTAMP "${plCFile}" plCAfter "${timeformat}")
- file(TIMESTAMP "${plDFile}" plDAfter "${timeformat}")
- if (NOT plCAfter GREATER plCBefore)
- message(SEND_ERROR "file (${plCFile}) should have changed!")
- endif()
- if (NOT plDAfter GREATER plDBefore)
- message(SEND_ERROR "file (${plDFile}) should have changed!")
- endif()
+# -- Test
+# OBJECT libraries
+add_subdirectory(objectLibrary)
-endif()
+# -- Test
+# Source files with the same basename in different subdirectories
+add_subdirectory(sameName)
# -- Test
-# Tests various .ui include directories
-add_subdirectory(uicInclude)
+# Tests static library cycles
+add_subdirectory(staticLibraryCycle)
# -- Test
# Complex test case
diff --git a/Tests/QtAutogen/complex/CMakeLists.txt b/Tests/QtAutogen/complex/CMakeLists.txt
index d48f6cc54..2043ccf58 100644
--- a/Tests/QtAutogen/complex/CMakeLists.txt
+++ b/Tests/QtAutogen/complex/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.7)
+cmake_minimum_required(VERSION 3.9)
# -- Test: AUTOMOC AUTORCC AUTOUIC
add_definitions(-DFOO -DSomeDefine="Barx")
diff --git a/Tests/QtAutogen/mocCMP0071/CMakeLists.txt b/Tests/QtAutogen/mocCMP0071/CMakeLists.txt
new file mode 100644
index 000000000..003fa088f
--- /dev/null
+++ b/Tests/QtAutogen/mocCMP0071/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 3.9)
+project(mocCMP0071 CXX)
+add_subdirectory(OLD)
+add_subdirectory(NEW)
diff --git a/Tests/QtAutogen/mocCMP0071/NEW/CMakeLists.txt b/Tests/QtAutogen/mocCMP0071/NEW/CMakeLists.txt
new file mode 100644
index 000000000..0237afc39
--- /dev/null
+++ b/Tests/QtAutogen/mocCMP0071/NEW/CMakeLists.txt
@@ -0,0 +1,16 @@
+cmake_minimum_required(VERSION 3.9)
+cmake_policy(SET CMP0071 NEW)
+
+# *Generate* files
+set(CSD ${CMAKE_CURRENT_SOURCE_DIR})
+set(CBD ${CMAKE_CURRENT_BINARY_DIR})
+add_custom_command(
+ OUTPUT ${CBD}/Obj_p.h ${CBD}/Obj.hpp ${CBD}/Obj.cpp ${CBD}/main.cpp
+ COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/../Obj_p.h ${CBD}/Obj_p.h
+ COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/../Obj.hpp ${CBD}/Obj.hpp
+ COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/../Obj.cpp ${CBD}/Obj.cpp
+ COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/../main.cpp ${CBD}/main.cpp)
+
+add_executable(mocCMP0071New ${CBD}/Obj.cpp ${CBD}/main.cpp)
+target_link_libraries(mocCMP0071New ${QT_LIBRARIES})
+set_target_properties(mocCMP0071New PROPERTIES AUTOMOC ON)
diff --git a/Tests/QtAutogen/mocCMP0071/OLD/CMakeLists.txt b/Tests/QtAutogen/mocCMP0071/OLD/CMakeLists.txt
new file mode 100644
index 000000000..569943336
--- /dev/null
+++ b/Tests/QtAutogen/mocCMP0071/OLD/CMakeLists.txt
@@ -0,0 +1,18 @@
+cmake_minimum_required(VERSION 3.9)
+cmake_policy(SET CMP0071 OLD)
+
+# *Generate* files
+set(CSD ${CMAKE_CURRENT_SOURCE_DIR})
+set(CBD ${CMAKE_CURRENT_BINARY_DIR})
+add_custom_command(
+ OUTPUT ${CBD}/Obj_p.h ${CBD}/Obj.hpp ${CBD}/Obj.cpp ${CBD}/main.cpp
+ COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/../Obj_p.h ${CBD}/Obj_p.h
+ COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/../Obj.hpp ${CBD}/Obj.hpp
+ COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/../Obj.cpp ${CBD}/Obj.cpp
+ COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/../main.cpp ${CBD}/main.cpp)
+
+# Generate moc files externally
+qtx_wrap_cpp(mocCMP0071OldMoc ${CBD}/Obj.hpp ${CBD}/Obj_p.h)
+add_executable(mocCMP0071Old ${CBD}/Obj.cpp ${CBD}/main.cpp ${mocCMP0071OldMoc})
+target_link_libraries(mocCMP0071Old ${QT_LIBRARIES})
+set_target_properties(mocCMP0071Old PROPERTIES AUTOMOC ON)
diff --git a/Tests/QtAutogen/mocCMP0071/Obj.cpp b/Tests/QtAutogen/mocCMP0071/Obj.cpp
new file mode 100644
index 000000000..1ae50edc9
--- /dev/null
+++ b/Tests/QtAutogen/mocCMP0071/Obj.cpp
@@ -0,0 +1,20 @@
+#include "Obj.hpp"
+#include "Obj_p.h"
+
+ObjPrivate::ObjPrivate()
+{
+}
+
+ObjPrivate::~ObjPrivate()
+{
+}
+
+Obj::Obj()
+ : d(new ObjPrivate)
+{
+}
+
+Obj::~Obj()
+{
+ delete d;
+}
diff --git a/Tests/QtAutogen/mocCMP0071/Obj.hpp b/Tests/QtAutogen/mocCMP0071/Obj.hpp
new file mode 100644
index 000000000..f064e4793
--- /dev/null
+++ b/Tests/QtAutogen/mocCMP0071/Obj.hpp
@@ -0,0 +1,19 @@
+#ifndef OBJ_HPP
+#define OBJ_HPP
+
+#include <QObject>
+
+// Object source comes without any _moc/.moc includes
+class ObjPrivate;
+class Obj : public QObject
+{
+ Q_OBJECT
+public:
+ Obj();
+ ~Obj();
+
+private:
+ ObjPrivate* const d;
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocCMP0071/Obj_p.h b/Tests/QtAutogen/mocCMP0071/Obj_p.h
new file mode 100644
index 000000000..cb1e5df71
--- /dev/null
+++ b/Tests/QtAutogen/mocCMP0071/Obj_p.h
@@ -0,0 +1,14 @@
+#ifndef OBJ_P_HPP
+#define OBJ_P_HPP
+
+#include <QObject>
+
+class ObjPrivate : public QObject
+{
+ Q_OBJECT
+public:
+ ObjPrivate();
+ ~ObjPrivate();
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocPlugin/main.cpp b/Tests/QtAutogen/mocCMP0071/main.cpp
index 3ba2ddc6d..3887840ba 100644
--- a/Tests/QtAutogen/mocPlugin/main.cpp
+++ b/Tests/QtAutogen/mocCMP0071/main.cpp
@@ -1,6 +1,7 @@
-#include "StyleA.hpp"
+#include "Obj.hpp"
int main(int argv, char** args)
{
+ Obj obj;
return 0;
}
diff --git a/Tests/QtAutogen/mocDepends/CMakeLists.txt b/Tests/QtAutogen/mocDepends/CMakeLists.txt
index 6241ef93d..8217b8dbf 100644
--- a/Tests/QtAutogen/mocDepends/CMakeLists.txt
+++ b/Tests/QtAutogen/mocDepends/CMakeLists.txt
@@ -1,4 +1,5 @@
cmake_minimum_required(VERSION 3.9)
+cmake_policy(SET CMP0071 NEW)
project(mocDepends CXX)
if (QT_TEST_VERSION STREQUAL 4)
@@ -43,7 +44,6 @@ add_custom_command(
add_executable(mocDepGenFile testGenFile.cpp ${CBD}/GenFile.hpp)
target_link_libraries(mocDepGenFile ${QT_CORE_TARGET})
set_target_properties(mocDepGenFile PROPERTIES AUTOMOC TRUE)
-set_property(TARGET mocDepGenFile PROPERTY __UNDOCUMENTED_AUTOGEN_GENERATED_FILES 1)
# -- Test dependency on header generating custom target
diff --git a/Tests/QtAutogen/mocInclude/EObjA.cpp b/Tests/QtAutogen/mocInclude/EObjA.cpp
new file mode 100644
index 000000000..ca713b261
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/EObjA.cpp
@@ -0,0 +1,43 @@
+#include "EObjA.hpp"
+#include "EObjAExtra.hpp"
+#include "EObjA_p.hpp"
+
+class EObjALocal : public QObject
+{
+ Q_OBJECT
+public:
+ EObjALocal();
+ ~EObjALocal();
+};
+
+EObjALocal::EObjALocal()
+{
+}
+
+EObjALocal::~EObjALocal()
+{
+}
+
+EObjAPrivate::EObjAPrivate()
+{
+ EObjALocal localObj;
+ EObjAExtra extraObj;
+}
+
+EObjAPrivate::~EObjAPrivate()
+{
+}
+
+EObjA::EObjA()
+ : d(new EObjAPrivate)
+{
+}
+
+EObjA::~EObjA()
+{
+}
+
+// For EObjALocal
+#include "EObjA.moc"
+// - Not the own header
+#include "moc_EObjAExtra.cpp"
diff --git a/Tests/QtAutogen/mocInclude/EObjA.hpp b/Tests/QtAutogen/mocInclude/EObjA.hpp
new file mode 100644
index 000000000..0939ab66d
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/EObjA.hpp
@@ -0,0 +1,19 @@
+#ifndef EOBJA_HPP
+#define EOBJA_HPP
+
+#include <QObject>
+
+// Sources includes a moc_ includes of an extra object
+class EObjAPrivate;
+class EObjA : public QObject
+{
+ Q_OBJECT
+public:
+ EObjA();
+ ~EObjA();
+
+private:
+ EObjAPrivate* const d;
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocInclude/EObjAExtra.cpp b/Tests/QtAutogen/mocInclude/EObjAExtra.cpp
new file mode 100644
index 000000000..369ca8f77
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/EObjAExtra.cpp
@@ -0,0 +1,20 @@
+#include "EObjAExtra.hpp"
+#include "EObjAExtra_p.hpp"
+
+EObjAExtraPrivate::EObjAExtraPrivate()
+{
+}
+
+EObjAExtraPrivate::~EObjAExtraPrivate()
+{
+}
+
+EObjAExtra::EObjAExtra()
+ : d(new EObjAExtraPrivate)
+{
+}
+
+EObjAExtra::~EObjAExtra()
+{
+ delete d;
+}
diff --git a/Tests/QtAutogen/mocInclude/EObjAExtra.hpp b/Tests/QtAutogen/mocInclude/EObjAExtra.hpp
new file mode 100644
index 000000000..b10681d59
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/EObjAExtra.hpp
@@ -0,0 +1,18 @@
+#ifndef EOBJAEXTRA_HPP
+#define EOBJAEXTRA_HPP
+
+#include <QObject>
+
+class EObjAExtraPrivate;
+class EObjAExtra : public QObject
+{
+ Q_OBJECT
+public:
+ EObjAExtra();
+ ~EObjAExtra();
+
+private:
+ EObjAExtraPrivate* const d;
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocInclude/EObjAExtra_p.hpp b/Tests/QtAutogen/mocInclude/EObjAExtra_p.hpp
new file mode 100644
index 000000000..dea6cb5ab
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/EObjAExtra_p.hpp
@@ -0,0 +1,12 @@
+#ifndef EOBJAEXTRA_P_HPP
+#define EOBJAEXTRA_P_HPP
+
+class EObjAExtraPrivate : public QObject
+{
+ Q_OBJECT
+public:
+ EObjAExtraPrivate();
+ ~EObjAExtraPrivate();
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocInclude/EObjA_p.hpp b/Tests/QtAutogen/mocInclude/EObjA_p.hpp
new file mode 100644
index 000000000..1e0d7e11d
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/EObjA_p.hpp
@@ -0,0 +1,12 @@
+#ifndef EOBJA_P_HPP
+#define EOBJA_P_HPP
+
+class EObjAPrivate : public QObject
+{
+ Q_OBJECT
+public:
+ EObjAPrivate();
+ ~EObjAPrivate();
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocInclude/EObjB.cpp b/Tests/QtAutogen/mocInclude/EObjB.cpp
new file mode 100644
index 000000000..d19fbfa6c
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/EObjB.cpp
@@ -0,0 +1,44 @@
+#include "EObjB.hpp"
+#include "EObjB_p.hpp"
+#include "subExtra/EObjBExtra.hpp"
+
+class EObjBLocal : public QObject
+{
+ Q_OBJECT
+public:
+ EObjBLocal();
+ ~EObjBLocal();
+};
+
+EObjBLocal::EObjBLocal()
+{
+}
+
+EObjBLocal::~EObjBLocal()
+{
+}
+
+EObjBPrivate::EObjBPrivate()
+{
+ EObjBLocal localObj;
+ EObjBExtra extraObj;
+}
+
+EObjBPrivate::~EObjBPrivate()
+{
+}
+
+EObjB::EObjB()
+ : d(new EObjBPrivate)
+{
+}
+
+EObjB::~EObjB()
+{
+}
+
+// For EObjBLocal
+#include "EObjB.moc"
+// - Not the own header
+// - in a subdirectory
+#include "subExtra/moc_EObjBExtra.cpp"
diff --git a/Tests/QtAutogen/mocInclude/EObjB.hpp b/Tests/QtAutogen/mocInclude/EObjB.hpp
new file mode 100644
index 000000000..6632bdb07
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/EObjB.hpp
@@ -0,0 +1,19 @@
+#ifndef EOBJB_HPP
+#define EOBJB_HPP
+
+#include <QObject>
+
+// Sources includes a moc_ includes of an extra object in a subdirectory
+class EObjBPrivate;
+class EObjB : public QObject
+{
+ Q_OBJECT
+public:
+ EObjB();
+ ~EObjB();
+
+private:
+ EObjBPrivate* const d;
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocInclude/EObjB_p.hpp b/Tests/QtAutogen/mocInclude/EObjB_p.hpp
new file mode 100644
index 000000000..2905f2891
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/EObjB_p.hpp
@@ -0,0 +1,12 @@
+#ifndef EOBJB_P_HPP
+#define EOBJB_P_HPP
+
+class EObjBPrivate : public QObject
+{
+ Q_OBJECT
+public:
+ EObjBPrivate();
+ ~EObjBPrivate();
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocInclude/LObjA.cpp b/Tests/QtAutogen/mocInclude/LObjA.cpp
new file mode 100644
index 000000000..9aae9917f
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/LObjA.cpp
@@ -0,0 +1,39 @@
+#include "LObjA.hpp"
+#include "LObjA_p.h"
+
+class LObjALocal : public QObject
+{
+ Q_OBJECT
+public:
+ LObjALocal();
+ ~LObjALocal();
+};
+
+LObjALocal::LObjALocal()
+{
+}
+
+LObjALocal::~LObjALocal()
+{
+}
+
+LObjAPrivate::LObjAPrivate()
+{
+ LObjALocal localObj;
+}
+
+LObjAPrivate::~LObjAPrivate()
+{
+}
+
+LObjA::LObjA()
+ : d(new LObjAPrivate)
+{
+}
+
+LObjA::~LObjA()
+{
+ delete d;
+}
+
+#include "LObjA.moc"
diff --git a/Tests/QtAutogen/mocInclude/LObjA.hpp b/Tests/QtAutogen/mocInclude/LObjA.hpp
new file mode 100644
index 000000000..aac670c00
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/LObjA.hpp
@@ -0,0 +1,19 @@
+#ifndef LOBJA_HPP
+#define LOBJA_HPP
+
+#include <QObject>
+
+// Object source comes with a .moc include
+class LObjAPrivate;
+class LObjA : public QObject
+{
+ Q_OBJECT
+public:
+ LObjA();
+ ~LObjA();
+
+private:
+ LObjAPrivate* const d;
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocInclude/LObjA_p.h b/Tests/QtAutogen/mocInclude/LObjA_p.h
new file mode 100644
index 000000000..ebe839579
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/LObjA_p.h
@@ -0,0 +1,12 @@
+#ifndef LOBJA_P_HPP
+#define LOBJA_P_HPP
+
+class LObjAPrivate : public QObject
+{
+ Q_OBJECT
+public:
+ LObjAPrivate();
+ ~LObjAPrivate();
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocInclude/LObjB.cpp b/Tests/QtAutogen/mocInclude/LObjB.cpp
new file mode 100644
index 000000000..7485d8fca
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/LObjB.cpp
@@ -0,0 +1,40 @@
+#include "LObjB.hpp"
+#include "LObjB_p.h"
+
+class LObjBLocal : public QObject
+{
+ Q_OBJECT
+public:
+ LObjBLocal();
+ ~LObjBLocal();
+};
+
+LObjBLocal::LObjBLocal()
+{
+}
+
+LObjBLocal::~LObjBLocal()
+{
+}
+
+LObjBPrivate::LObjBPrivate()
+{
+ LObjBLocal localObj;
+}
+
+LObjBPrivate::~LObjBPrivate()
+{
+}
+
+LObjB::LObjB()
+ : d(new LObjBPrivate)
+{
+}
+
+LObjB::~LObjB()
+{
+ delete d;
+}
+
+#include "LObjB.moc"
+#include "moc_LObjB.cpp"
diff --git a/Tests/QtAutogen/mocInclude/LObjB.hpp b/Tests/QtAutogen/mocInclude/LObjB.hpp
new file mode 100644
index 000000000..eb4e58d79
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/LObjB.hpp
@@ -0,0 +1,19 @@
+#ifndef LLObjB_HPP
+#define LLObjB_HPP
+
+#include <QObject>
+
+// Object source comes with a .moc and a _moc include
+class LObjBPrivate;
+class LObjB : public QObject
+{
+ Q_OBJECT
+public:
+ LObjB();
+ ~LObjB();
+
+private:
+ LObjBPrivate* const d;
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocInclude/LObjB_p.h b/Tests/QtAutogen/mocInclude/LObjB_p.h
new file mode 100644
index 000000000..b871f2d2a
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/LObjB_p.h
@@ -0,0 +1,12 @@
+#ifndef LOBJB_P_HPP
+#define LOBJB_P_HPP
+
+class LObjBPrivate : public QObject
+{
+ Q_OBJECT
+public:
+ LObjBPrivate();
+ ~LObjBPrivate();
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocInclude/ObjA.cpp b/Tests/QtAutogen/mocInclude/ObjA.cpp
index 1b0311d30..6f6b90ef1 100644
--- a/Tests/QtAutogen/mocInclude/ObjA.cpp
+++ b/Tests/QtAutogen/mocInclude/ObjA.cpp
@@ -1,24 +1,20 @@
#include "ObjA.hpp"
+#include "ObjA_p.h"
-class SubObjA : public QObject
+ObjAPrivate::ObjAPrivate()
{
- Q_OBJECT
-
-public:
- SubObjA() {}
- ~SubObjA() {}
-
- Q_SLOT
- void aSlot();
-};
+}
-void SubObjA::aSlot()
+ObjAPrivate::~ObjAPrivate()
{
}
-void ObjA::go()
+ObjA::ObjA()
+ : d(new ObjAPrivate)
{
- SubObjA subObj;
}
-#include "ObjA.moc"
+ObjA::~ObjA()
+{
+ delete d;
+}
diff --git a/Tests/QtAutogen/mocInclude/ObjA.hpp b/Tests/QtAutogen/mocInclude/ObjA.hpp
index 281e90d86..f16c924aa 100644
--- a/Tests/QtAutogen/mocInclude/ObjA.hpp
+++ b/Tests/QtAutogen/mocInclude/ObjA.hpp
@@ -3,11 +3,17 @@
#include <QObject>
+// Object source comes without any _moc/.moc includes
+class ObjAPrivate;
class ObjA : public QObject
{
Q_OBJECT
- Q_SLOT
- void go();
+public:
+ ObjA();
+ ~ObjA();
+
+private:
+ ObjAPrivate* const d;
};
#endif
diff --git a/Tests/QtAutogen/mocInclude/ObjA_p.h b/Tests/QtAutogen/mocInclude/ObjA_p.h
new file mode 100644
index 000000000..eb60c9800
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/ObjA_p.h
@@ -0,0 +1,12 @@
+#ifndef OBJA_P_HPP
+#define OBJA_P_HPP
+
+class ObjAPrivate : public QObject
+{
+ Q_OBJECT
+public:
+ ObjAPrivate();
+ ~ObjAPrivate();
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocInclude/ObjB.cpp b/Tests/QtAutogen/mocInclude/ObjB.cpp
index 5ff315dc7..a6f2509af 100644
--- a/Tests/QtAutogen/mocInclude/ObjB.cpp
+++ b/Tests/QtAutogen/mocInclude/ObjB.cpp
@@ -1,25 +1,22 @@
#include "ObjB.hpp"
+#include "ObjB_p.h"
-class SubObjB : public QObject
+ObjBPrivate::ObjBPrivate()
{
- Q_OBJECT
-
-public:
- SubObjB() {}
- ~SubObjB() {}
+}
- Q_SLOT
- void aSlot();
-};
+ObjBPrivate::~ObjBPrivate()
+{
+}
-void SubObjB::aSlot()
+ObjB::ObjB()
+ : d(new ObjBPrivate)
{
}
-void ObjB::go()
+ObjB::~ObjB()
{
- SubObjB subObj;
+ delete d;
}
-#include "ObjB.moc"
#include "moc_ObjB.cpp"
diff --git a/Tests/QtAutogen/mocInclude/ObjB.hpp b/Tests/QtAutogen/mocInclude/ObjB.hpp
index 94f3d498c..2ac8d1700 100644
--- a/Tests/QtAutogen/mocInclude/ObjB.hpp
+++ b/Tests/QtAutogen/mocInclude/ObjB.hpp
@@ -1,13 +1,19 @@
-#ifndef OBJB_HPP
-#define OBJB_HPP
+#ifndef ObjB_HPP
+#define ObjB_HPP
#include <QObject>
+// Object source comes with a _moc include
+class ObjBPrivate;
class ObjB : public QObject
{
Q_OBJECT
- Q_SLOT
- void go();
+public:
+ ObjB();
+ ~ObjB();
+
+private:
+ ObjBPrivate* const d;
};
#endif
diff --git a/Tests/QtAutogen/mocInclude/ObjB_p.h b/Tests/QtAutogen/mocInclude/ObjB_p.h
new file mode 100644
index 000000000..418da6578
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/ObjB_p.h
@@ -0,0 +1,12 @@
+#ifndef OBJB_P_HPP
+#define OBJB_P_HPP
+
+class ObjBPrivate : public QObject
+{
+ Q_OBJECT
+public:
+ ObjBPrivate();
+ ~ObjBPrivate();
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocInclude/ObjC.cpp b/Tests/QtAutogen/mocInclude/ObjC.cpp
deleted file mode 100644
index 8ca34cbb4..000000000
--- a/Tests/QtAutogen/mocInclude/ObjC.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-#include "ObjC.hpp"
-
-class SubObjC : public QObject
-{
- Q_OBJECT
-
-public:
- SubObjC() {}
- ~SubObjC() {}
-
- Q_SLOT
- void aSlot();
-};
-
-void SubObjC::aSlot()
-{
-}
-
-void ObjC::go()
-{
- SubObjC subObj;
-}
-
-#include "ObjC.moc"
-// Not the own header
-#include "moc_ObjD.cpp"
diff --git a/Tests/QtAutogen/mocInclude/ObjC.hpp b/Tests/QtAutogen/mocInclude/ObjC.hpp
deleted file mode 100644
index a8e98eb1e..000000000
--- a/Tests/QtAutogen/mocInclude/ObjC.hpp
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef OBJC_HPP
-#define OBJC_HPP
-
-#include <QObject>
-
-class ObjC : public QObject
-{
- Q_OBJECT
- Q_SLOT
- void go();
-};
-
-#endif
diff --git a/Tests/QtAutogen/mocInclude/ObjD.cpp b/Tests/QtAutogen/mocInclude/ObjD.cpp
deleted file mode 100644
index c18aec152..000000000
--- a/Tests/QtAutogen/mocInclude/ObjD.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-#include "ObjD.hpp"
-
-class SubObjD : public QObject
-{
- Q_OBJECT
-
-public:
- SubObjD() {}
- ~SubObjD() {}
-
- Q_SLOT
- void aSlot();
-};
-
-void SubObjD::aSlot()
-{
-}
-
-void ObjD::go()
-{
- SubObjD subObj;
-}
-
-#include "ObjD.moc"
-// Header in subdirectory
-#include "subA/moc_SubObjA.cpp"
diff --git a/Tests/QtAutogen/mocInclude/ObjD.hpp b/Tests/QtAutogen/mocInclude/ObjD.hpp
deleted file mode 100644
index b6ee09808..000000000
--- a/Tests/QtAutogen/mocInclude/ObjD.hpp
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef OBJD_HPP
-#define OBJD_HPP
-
-#include <QObject>
-
-class ObjD : public QObject
-{
- Q_OBJECT
- Q_SLOT
- void go();
-};
-
-#endif
diff --git a/Tests/QtAutogen/mocInclude/SObjA.cpp b/Tests/QtAutogen/mocInclude/SObjA.cpp
new file mode 100644
index 000000000..7e75bf973
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/SObjA.cpp
@@ -0,0 +1,11 @@
+#include "SObjA.hpp"
+
+SObjA::SObjA()
+{
+}
+
+SObjA::~SObjA()
+{
+}
+
+#include "SObjA.moc"
diff --git a/Tests/QtAutogen/mocInclude/SObjA.hpp b/Tests/QtAutogen/mocInclude/SObjA.hpp
new file mode 100644
index 000000000..1436abc6c
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/SObjA.hpp
@@ -0,0 +1,15 @@
+#ifndef SOBJA_HPP
+#define SOBJA_HPP
+
+#include <QObject>
+
+// Object source includes externally generated .moc file
+class SObjA : public QObject
+{
+ Q_OBJECT
+public:
+ SObjA();
+ ~SObjA();
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocInclude/SObjB.cpp.in b/Tests/QtAutogen/mocInclude/SObjB.cpp.in
new file mode 100644
index 000000000..b1cc12ab2
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/SObjB.cpp.in
@@ -0,0 +1,11 @@
+#include "SObjB.hpp"
+
+SObjB::SObjB()
+{
+}
+
+SObjB::~SObjB()
+{
+}
+
+#include "SObjB.moc"
diff --git a/Tests/QtAutogen/mocInclude/SObjB.hpp.in b/Tests/QtAutogen/mocInclude/SObjB.hpp.in
new file mode 100644
index 000000000..5e396aea8
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/SObjB.hpp.in
@@ -0,0 +1,15 @@
+#ifndef SOBJB_HPP
+#define SOBJB_HPP
+
+#include <QObject>
+
+// Object source includes externally generated .moc file
+class SObjB : public QObject
+{
+ Q_OBJECT
+public:
+ SObjB();
+ ~SObjB();
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocInclude/SObjC.cpp b/Tests/QtAutogen/mocInclude/SObjC.cpp
new file mode 100644
index 000000000..1e8d397f9
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/SObjC.cpp
@@ -0,0 +1,35 @@
+#include "SObjC.hpp"
+
+void SObjCLocalFunction();
+
+class SObjCLocal : public QObject
+{
+ Q_OBJECT
+
+public:
+ SObjCLocal();
+ ~SObjCLocal();
+};
+
+SObjCLocal::SObjCLocal()
+{
+}
+
+SObjCLocal::~SObjCLocal()
+{
+}
+
+SObjC::SObjC()
+{
+ SObjCLocal localObject;
+ SObjCLocalFunction();
+}
+
+SObjC::~SObjC()
+{
+}
+
+#include "SObjC.moc"
+#include "moc_SObjC.cpp"
+// Include moc_ file for which the header is SKIP_AUTOMOC enabled
+#include "moc_SObjCExtra.cpp"
diff --git a/Tests/QtAutogen/mocInclude/SObjC.hpp b/Tests/QtAutogen/mocInclude/SObjC.hpp
new file mode 100644
index 000000000..def0f9d96
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/SObjC.hpp
@@ -0,0 +1,15 @@
+#ifndef SOBJC_HPP
+#define SOBJC_HPP
+
+#include <QObject>
+
+// Object source includes externally generated .moc file
+class SObjC : public QObject
+{
+ Q_OBJECT
+public:
+ SObjC();
+ ~SObjC();
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocInclude/SObjCExtra.cpp b/Tests/QtAutogen/mocInclude/SObjCExtra.cpp
new file mode 100644
index 000000000..55dd1c315
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/SObjCExtra.cpp
@@ -0,0 +1,31 @@
+#include "SObjCExtra.hpp"
+
+class SObjCLocalExtra : public QObject
+{
+ Q_OBJECT
+
+public:
+ SObjCLocalExtra();
+ ~SObjCLocalExtra();
+};
+
+SObjCLocalExtra::SObjCLocalExtra()
+{
+}
+
+SObjCLocalExtra::~SObjCLocalExtra()
+{
+}
+
+SObjCExtra::SObjCExtra()
+{
+}
+
+SObjCExtra::~SObjCExtra()
+{
+}
+
+// Externally generated header moc
+#include "SObjCExtra_extMoc.cpp"
+// AUTOMOC generated source moc
+#include "SObjCExtra.moc"
diff --git a/Tests/QtAutogen/mocInclude/SObjCExtra.hpp b/Tests/QtAutogen/mocInclude/SObjCExtra.hpp
new file mode 100644
index 000000000..08545ac29
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/SObjCExtra.hpp
@@ -0,0 +1,15 @@
+#ifndef SOBJCEXTRA_HPP
+#define SOBJCEXTRA_HPP
+
+#include <QObject>
+
+// Object source includes externally generated .moc file
+class SObjCExtra : public QObject
+{
+ Q_OBJECT
+public:
+ SObjCExtra();
+ ~SObjCExtra();
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocInclude/SObjCExtra.moc.in b/Tests/QtAutogen/mocInclude/SObjCExtra.moc.in
new file mode 100644
index 000000000..00fc4aabe
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/SObjCExtra.moc.in
@@ -0,0 +1,4 @@
+
+void SObjCLocalFunction()
+{
+}
diff --git a/Tests/QtAutogen/mocInclude/shared.cmake b/Tests/QtAutogen/mocInclude/shared.cmake
new file mode 100644
index 000000000..d05f27c27
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/shared.cmake
@@ -0,0 +1,71 @@
+# Test moc include patterns
+include_directories("../mocInclude")
+include_directories(${CMAKE_CURRENT_BINARY_DIR})
+
+# Generate .moc file externally and enabled SKIP_AUTOMOC on the file
+qtx_generate_moc(
+ ${CMAKE_CURRENT_SOURCE_DIR}/../mocInclude/SObjA.hpp
+ ${CMAKE_CURRENT_BINARY_DIR}/SObjA.moc)
+set_property(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/../mocInclude/SObjA.cpp PROPERTY SKIP_AUTOMOC ON)
+
+# Generate .moc file externally from generated source file
+# and enabled SKIP_AUTOMOC on the source file
+add_custom_command(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/SObjB.hpp
+ COMMAND ${CMAKE_COMMAND} -E copy
+ ${CMAKE_CURRENT_SOURCE_DIR}/../mocInclude/SObjB.hpp.in
+ ${CMAKE_CURRENT_BINARY_DIR}/SObjB.hpp)
+add_custom_command(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/SObjB.cpp
+ COMMAND ${CMAKE_COMMAND} -E copy
+ ${CMAKE_CURRENT_SOURCE_DIR}/../mocInclude/SObjB.cpp.in
+ ${CMAKE_CURRENT_BINARY_DIR}/SObjB.cpp)
+qtx_generate_moc(
+ ${CMAKE_CURRENT_BINARY_DIR}/SObjB.hpp
+ ${CMAKE_CURRENT_BINARY_DIR}/SObjB.moc)
+set_property(SOURCE ${CMAKE_CURRENT_BINARY_DIR}/SObjB.cpp PROPERTY SKIP_AUTOMOC ON)
+
+# Generate moc file externally and enabled SKIP_AUTOMOC on the header
+qtx_generate_moc(
+ ${CMAKE_CURRENT_SOURCE_DIR}/../mocInclude/SObjCExtra.hpp
+ ${CMAKE_CURRENT_BINARY_DIR}/SObjCExtra_extMoc.cpp)
+set_property(
+ SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/../mocInclude/SObjCExtra.hpp
+ PROPERTY SKIP_AUTOMOC ON)
+# Custom target to depend on
+set(SOBJC_MOC ${CMAKE_CURRENT_BINARY_DIR}/moc_SObjCExtra.cpp)
+add_custom_target("${MOC_INCLUDE_NAME}_SOBJC"
+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/SObjCExtra_extMoc.cpp
+ BYPRODUCTS ${SOBJC_MOC}
+ COMMAND ${CMAKE_COMMAND} -E copy
+ ${CMAKE_CURRENT_SOURCE_DIR}/../mocInclude/SObjCExtra.moc.in
+ ${SOBJC_MOC})
+
+# MOC_INCLUDE_NAME must be defined by the includer
+add_executable(${MOC_INCLUDE_NAME}
+ # Common sources
+ ../mocInclude/ObjA.cpp
+ ../mocInclude/ObjB.cpp
+
+ ../mocInclude/LObjA.cpp
+ ../mocInclude/LObjB.cpp
+
+ ../mocInclude/EObjA.cpp
+ ../mocInclude/EObjAExtra.cpp
+ ../mocInclude/EObjB.cpp
+ ../mocInclude/subExtra/EObjBExtra.cpp
+
+ ../mocInclude/SObjA.cpp
+ ${CMAKE_CURRENT_BINARY_DIR}/SObjA.moc
+ ${CMAKE_CURRENT_BINARY_DIR}/SObjB.cpp
+ ${CMAKE_CURRENT_BINARY_DIR}/SObjB.moc
+ ../mocInclude/SObjC.cpp
+ ../mocInclude/SObjCExtra.hpp
+ ../mocInclude/SObjCExtra.cpp
+
+ ../mocInclude/subGlobal/GObj.cpp
+ main.cpp
+)
+add_dependencies(${MOC_INCLUDE_NAME} "${MOC_INCLUDE_NAME}_SOBJC")
+target_link_libraries(${MOC_INCLUDE_NAME} ${QT_LIBRARIES})
+set_target_properties(${MOC_INCLUDE_NAME} PROPERTIES AUTOMOC ON)
diff --git a/Tests/QtAutogen/mocInclude/subA/SubObjA.cpp b/Tests/QtAutogen/mocInclude/subA/SubObjA.cpp
deleted file mode 100644
index a05f6e37e..000000000
--- a/Tests/QtAutogen/mocInclude/subA/SubObjA.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-#include "SubObjA.hpp"
-
-namespace subA {
-
-class SubObjA : public QObject
-{
- Q_OBJECT
-
-public:
- SubObjA() {}
- ~SubObjA() {}
-
- Q_SLOT
- void aSlot();
-};
-
-void SubObjA::aSlot()
-{
-}
-
-void ObjA::go()
-{
- SubObjA subObj;
-}
-}
-
-#include "SubObjA.moc"
diff --git a/Tests/QtAutogen/mocInclude/subA/SubObjA.hpp b/Tests/QtAutogen/mocInclude/subA/SubObjA.hpp
deleted file mode 100644
index 31a18b618..000000000
--- a/Tests/QtAutogen/mocInclude/subA/SubObjA.hpp
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef SUBOBJA_HPP
-#define SUBOBJA_HPP
-
-#include <QObject>
-
-namespace subA {
-
-class ObjA : public QObject
-{
- Q_OBJECT
- Q_SLOT
- void go();
-};
-}
-
-#endif
diff --git a/Tests/QtAutogen/mocInclude/subB/SubObjB.cpp b/Tests/QtAutogen/mocInclude/subB/SubObjB.cpp
deleted file mode 100644
index 1e77639b2..000000000
--- a/Tests/QtAutogen/mocInclude/subB/SubObjB.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-#include "SubObjB.hpp"
-
-namespace subB {
-
-class SubObjB : public QObject
-{
- Q_OBJECT
-
-public:
- SubObjB() {}
- ~SubObjB() {}
-
- Q_SLOT
- void aSlot();
-};
-
-void SubObjB::aSlot()
-{
-}
-
-void ObjB::go()
-{
- SubObjB subObj;
-}
-}
-
-#include "SubObjB.moc"
diff --git a/Tests/QtAutogen/mocInclude/subB/SubObjB.hpp b/Tests/QtAutogen/mocInclude/subB/SubObjB.hpp
deleted file mode 100644
index 3f29fa289..000000000
--- a/Tests/QtAutogen/mocInclude/subB/SubObjB.hpp
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef SUBOBJB_HPP
-#define SUBOBJB_HPP
-
-#include <QObject>
-
-namespace subB {
-
-class ObjB : public QObject
-{
- Q_OBJECT
- Q_SLOT
- void go();
-};
-}
-
-#endif
diff --git a/Tests/QtAutogen/mocInclude/subC/SubObjC.cpp b/Tests/QtAutogen/mocInclude/subC/SubObjC.cpp
deleted file mode 100644
index c2d94ef26..000000000
--- a/Tests/QtAutogen/mocInclude/subC/SubObjC.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-#include "SubObjC.hpp"
-
-namespace subC {
-
-class SubObjC : public QObject
-{
- Q_OBJECT
-
-public:
- SubObjC() {}
- ~SubObjC() {}
-
- Q_SLOT
- void aSlot();
-};
-
-void SubObjC::aSlot()
-{
-}
-
-void ObjC::go()
-{
- SubObjC subObj;
-}
-}
-
-#include "SubObjC.moc"
diff --git a/Tests/QtAutogen/mocInclude/subC/SubObjC.hpp b/Tests/QtAutogen/mocInclude/subC/SubObjC.hpp
deleted file mode 100644
index dc251fd61..000000000
--- a/Tests/QtAutogen/mocInclude/subC/SubObjC.hpp
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef SUBOBJC_HPP
-#define SUBOBJC_HPP
-
-#include <QObject>
-
-namespace subC {
-
-class ObjC : public QObject
-{
- Q_OBJECT
- Q_SLOT
- void go();
-};
-}
-
-#endif
diff --git a/Tests/QtAutogen/mocInclude/subExtra/EObjBExtra.cpp b/Tests/QtAutogen/mocInclude/subExtra/EObjBExtra.cpp
new file mode 100644
index 000000000..c697866e7
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/subExtra/EObjBExtra.cpp
@@ -0,0 +1,20 @@
+#include "EObjBExtra.hpp"
+#include "EObjBExtra_p.hpp"
+
+EObjBExtraPrivate::EObjBExtraPrivate()
+{
+}
+
+EObjBExtraPrivate::~EObjBExtraPrivate()
+{
+}
+
+EObjBExtra::EObjBExtra()
+ : d(new EObjBExtraPrivate)
+{
+}
+
+EObjBExtra::~EObjBExtra()
+{
+ delete d;
+}
diff --git a/Tests/QtAutogen/mocInclude/subExtra/EObjBExtra.hpp b/Tests/QtAutogen/mocInclude/subExtra/EObjBExtra.hpp
new file mode 100644
index 000000000..3798d7f52
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/subExtra/EObjBExtra.hpp
@@ -0,0 +1,18 @@
+#ifndef EOBJBEXTRA_HPP
+#define EOBJBEXTRA_HPP
+
+#include <QObject>
+
+class EObjBExtraPrivate;
+class EObjBExtra : public QObject
+{
+ Q_OBJECT
+public:
+ EObjBExtra();
+ ~EObjBExtra();
+
+private:
+ EObjBExtraPrivate* const d;
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocInclude/subExtra/EObjBExtra_p.hpp b/Tests/QtAutogen/mocInclude/subExtra/EObjBExtra_p.hpp
new file mode 100644
index 000000000..db8a0961f
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/subExtra/EObjBExtra_p.hpp
@@ -0,0 +1,12 @@
+#ifndef EOBJBEXTRA_P_HPP
+#define EOBJBEXTRA_P_HPP
+
+class EObjBExtraPrivate : public QObject
+{
+ Q_OBJECT
+public:
+ EObjBExtraPrivate();
+ ~EObjBExtraPrivate();
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocInclude/subGlobal/GObj.cpp b/Tests/QtAutogen/mocInclude/subGlobal/GObj.cpp
new file mode 100644
index 000000000..6b92f2194
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/subGlobal/GObj.cpp
@@ -0,0 +1,41 @@
+#include "GObj.hpp"
+#include "GObj_p.hpp"
+
+namespace subGlobal {
+
+class GObjLocal : public QObject
+{
+ Q_OBJECT
+public:
+ GObjLocal();
+ ~GObjLocal();
+};
+
+GObjLocal::GObjLocal()
+{
+}
+
+GObjLocal::~GObjLocal()
+{
+}
+
+GObjPrivate::GObjPrivate()
+{
+}
+
+GObjPrivate::~GObjPrivate()
+{
+}
+
+GObj::GObj()
+{
+ GObjLocal localObj;
+}
+
+GObj::~GObj()
+{
+}
+}
+
+// For the local QObject
+#include "GObj.moc"
diff --git a/Tests/QtAutogen/mocInclude/subGlobal/GObj.hpp b/Tests/QtAutogen/mocInclude/subGlobal/GObj.hpp
new file mode 100644
index 000000000..2f9ee8207
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/subGlobal/GObj.hpp
@@ -0,0 +1,17 @@
+#ifndef GOBJ_HPP
+#define GOBJ_HPP
+
+#include <QObject>
+
+namespace subGlobal {
+
+class GObj : public QObject
+{
+ Q_OBJECT
+public:
+ GObj();
+ ~GObj();
+};
+}
+
+#endif
diff --git a/Tests/QtAutogen/mocInclude/subGlobal/GObj_p.hpp b/Tests/QtAutogen/mocInclude/subGlobal/GObj_p.hpp
new file mode 100644
index 000000000..7b37dfd18
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/subGlobal/GObj_p.hpp
@@ -0,0 +1,15 @@
+#ifndef GOBJ_P_HPP
+#define GOBJ_P_HPP
+
+namespace subGlobal {
+
+class GObjPrivate : public QObject
+{
+ Q_OBJECT
+public:
+ GObjPrivate();
+ ~GObjPrivate();
+};
+}
+
+#endif
diff --git a/Tests/QtAutogen/mocIncludeRelaxed/CMakeLists.txt b/Tests/QtAutogen/mocIncludeRelaxed/CMakeLists.txt
index 6a0829df7..97ba1df51 100644
--- a/Tests/QtAutogen/mocIncludeRelaxed/CMakeLists.txt
+++ b/Tests/QtAutogen/mocIncludeRelaxed/CMakeLists.txt
@@ -2,17 +2,16 @@
set(CMAKE_AUTOMOC_RELAXED_MODE TRUE)
-include_directories("../mocInclude")
+# Shared executable
+set(MOC_INCLUDE_NAME "mocIncludeRelaxed")
+include(${CMAKE_CURRENT_SOURCE_DIR}/../mocInclude/shared.cmake)
-add_executable(mocIncludeRelaxed
- ../mocInclude/ObjA.cpp
- ../mocInclude/ObjB.cpp
- ../mocInclude/ObjC.cpp
- ../mocInclude/ObjD.cpp
- ../mocInclude/subA/SubObjA.cpp
- ../mocInclude/subB/SubObjB.cpp
- ../mocInclude/subC/SubObjC.cpp
- main.cpp
+# Relaxed ony executable
+add_executable(mocIncludeRelaxedOnly
+ RObjA.cpp
+ RObjB.cpp
+ RObjC.cpp
+ RMain.cpp
)
-target_link_libraries(mocIncludeRelaxed ${QT_LIBRARIES})
-set_target_properties(mocIncludeRelaxed PROPERTIES AUTOMOC ON)
+target_link_libraries(mocIncludeRelaxedOnly ${QT_LIBRARIES})
+set_target_properties(mocIncludeRelaxedOnly PROPERTIES AUTOMOC ON)
diff --git a/Tests/QtAutogen/mocIncludeRelaxed/RMain.cpp b/Tests/QtAutogen/mocIncludeRelaxed/RMain.cpp
new file mode 100644
index 000000000..5b2c07032
--- /dev/null
+++ b/Tests/QtAutogen/mocIncludeRelaxed/RMain.cpp
@@ -0,0 +1,12 @@
+// Relaxed AUTOMOC objects
+#include "RObjA.hpp"
+#include "RObjB.hpp"
+#include "RObjC.hpp"
+
+int main(int argv, char** args)
+{
+ RObjA rObjA;
+ RObjB rObjB;
+ RObjC rObjC;
+ return 0;
+}
diff --git a/Tests/QtAutogen/mocIncludeRelaxed/RObjA.cpp b/Tests/QtAutogen/mocIncludeRelaxed/RObjA.cpp
new file mode 100644
index 000000000..2e2cf6a48
--- /dev/null
+++ b/Tests/QtAutogen/mocIncludeRelaxed/RObjA.cpp
@@ -0,0 +1,12 @@
+#include "RObjA.hpp"
+
+RObjA::RObjA()
+{
+}
+
+RObjA::~RObjA()
+{
+}
+
+// Relaxed include should moc the header instead
+#include "RObjA.moc"
diff --git a/Tests/QtAutogen/mocIncludeRelaxed/RObjA.hpp b/Tests/QtAutogen/mocIncludeRelaxed/RObjA.hpp
new file mode 100644
index 000000000..597418773
--- /dev/null
+++ b/Tests/QtAutogen/mocIncludeRelaxed/RObjA.hpp
@@ -0,0 +1,14 @@
+#ifndef ROBJA_HPP
+#define ROBJA_HPP
+
+#include <QObject>
+
+class RObjA : public QObject
+{
+ Q_OBJECT
+public:
+ RObjA();
+ ~RObjA();
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocIncludeRelaxed/RObjB.cpp b/Tests/QtAutogen/mocIncludeRelaxed/RObjB.cpp
new file mode 100644
index 000000000..c56d10f04
--- /dev/null
+++ b/Tests/QtAutogen/mocIncludeRelaxed/RObjB.cpp
@@ -0,0 +1,22 @@
+#include "RObjB.hpp"
+#include "RObjBExtra.hpp"
+
+RObjBExtra::RObjBExtra()
+{
+}
+
+RObjBExtra::~RObjBExtra()
+{
+}
+
+RObjB::RObjB()
+{
+ RObjBExtra extraObject;
+}
+
+RObjB::~RObjB()
+{
+}
+
+// Relaxed mode should run moc on RObjBExtra.hpp instead
+#include "RObjBExtra.moc"
diff --git a/Tests/QtAutogen/mocIncludeRelaxed/RObjB.hpp b/Tests/QtAutogen/mocIncludeRelaxed/RObjB.hpp
new file mode 100644
index 000000000..d6d0474ad
--- /dev/null
+++ b/Tests/QtAutogen/mocIncludeRelaxed/RObjB.hpp
@@ -0,0 +1,14 @@
+#ifndef ROBJB_HPP
+#define ROBJB_HPP
+
+#include <QObject>
+
+class RObjB : public QObject
+{
+ Q_OBJECT
+public:
+ RObjB();
+ ~RObjB();
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocIncludeRelaxed/RObjBExtra.hpp b/Tests/QtAutogen/mocIncludeRelaxed/RObjBExtra.hpp
new file mode 100644
index 000000000..5d6be752f
--- /dev/null
+++ b/Tests/QtAutogen/mocIncludeRelaxed/RObjBExtra.hpp
@@ -0,0 +1,14 @@
+#ifndef ROBJBEXTRA_HPP
+#define ROBJBEXTRA_HPP
+
+#include <QObject>
+
+class RObjBExtra : public QObject
+{
+ Q_OBJECT
+public:
+ RObjBExtra();
+ ~RObjBExtra();
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocIncludeRelaxed/RObjC.cpp b/Tests/QtAutogen/mocIncludeRelaxed/RObjC.cpp
new file mode 100644
index 000000000..4ba32f54b
--- /dev/null
+++ b/Tests/QtAutogen/mocIncludeRelaxed/RObjC.cpp
@@ -0,0 +1,30 @@
+#include "RObjC.hpp"
+#include <QObject>
+
+class RObjCPrivate : public QObject
+{
+ Q_OBJECT
+public:
+ RObjCPrivate();
+ ~RObjCPrivate();
+};
+
+RObjCPrivate::RObjCPrivate()
+{
+}
+
+RObjCPrivate::~RObjCPrivate()
+{
+}
+
+RObjC::RObjC()
+{
+ RObjCPrivate privateObject;
+}
+
+RObjC::~RObjC()
+{
+}
+
+// Relaxed include should moc this source instead of the header
+#include "moc_RObjC.cpp"
diff --git a/Tests/QtAutogen/mocIncludeRelaxed/RObjC.hpp b/Tests/QtAutogen/mocIncludeRelaxed/RObjC.hpp
new file mode 100644
index 000000000..5552ede4a
--- /dev/null
+++ b/Tests/QtAutogen/mocIncludeRelaxed/RObjC.hpp
@@ -0,0 +1,14 @@
+#ifndef ROBJC_HPP
+#define ROBJC_HPP
+
+#include <QObject>
+
+class RObjC : public QObject
+{
+ Q_OBJECT
+public:
+ RObjC();
+ ~RObjC();
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocIncludeRelaxed/main.cpp b/Tests/QtAutogen/mocIncludeRelaxed/main.cpp
index 142d59e69..5a3148dda 100644
--- a/Tests/QtAutogen/mocIncludeRelaxed/main.cpp
+++ b/Tests/QtAutogen/mocIncludeRelaxed/main.cpp
@@ -1,14 +1,26 @@
+#include "EObjA.hpp"
+#include "EObjB.hpp"
+#include "LObjA.hpp"
+#include "LObjB.hpp"
#include "ObjA.hpp"
#include "ObjB.hpp"
-#include "ObjC.hpp"
+#include "SObjA.hpp"
+#include "SObjB.hpp"
+#include "subGlobal/GObj.hpp"
int main(int argv, char** args)
{
+ subGlobal::GObj gObj;
ObjA objA;
ObjB objB;
- ObjC objC;
+ LObjA lObjA;
+ LObjB lObjB;
+ EObjA eObjA;
+ EObjB eObjB;
+ SObjA sObjA;
+ SObjB sObjB;
return 0;
}
// Header in global subdirectory
-#include "subB/moc_SubObjB.cpp"
+#include "subGlobal/moc_GObj.cpp"
diff --git a/Tests/QtAutogen/mocIncludeStrict/CMakeLists.txt b/Tests/QtAutogen/mocIncludeStrict/CMakeLists.txt
index 22e93a8ba..789354a22 100644
--- a/Tests/QtAutogen/mocIncludeStrict/CMakeLists.txt
+++ b/Tests/QtAutogen/mocIncludeStrict/CMakeLists.txt
@@ -1,18 +1,6 @@
# Test moc include patterns
set(CMAKE_AUTOMOC_RELAXED_MODE FALSE)
+set(MOC_INCLUDE_NAME "mocIncludeStrict")
-include_directories("../mocInclude")
-
-add_executable(mocIncludeStrict
- ../mocInclude/ObjA.cpp
- ../mocInclude/ObjB.cpp
- ../mocInclude/ObjC.cpp
- ../mocInclude/ObjD.cpp
- ../mocInclude/subA/SubObjA.cpp
- ../mocInclude/subB/SubObjB.cpp
- ../mocInclude/subC/SubObjC.cpp
- main.cpp
-)
-target_link_libraries(mocIncludeStrict ${QT_LIBRARIES})
-set_target_properties(mocIncludeStrict PROPERTIES AUTOMOC ON)
+include(${CMAKE_CURRENT_SOURCE_DIR}/../mocInclude/shared.cmake)
diff --git a/Tests/QtAutogen/mocIncludeStrict/main.cpp b/Tests/QtAutogen/mocIncludeStrict/main.cpp
index 142d59e69..5a3148dda 100644
--- a/Tests/QtAutogen/mocIncludeStrict/main.cpp
+++ b/Tests/QtAutogen/mocIncludeStrict/main.cpp
@@ -1,14 +1,26 @@
+#include "EObjA.hpp"
+#include "EObjB.hpp"
+#include "LObjA.hpp"
+#include "LObjB.hpp"
#include "ObjA.hpp"
#include "ObjB.hpp"
-#include "ObjC.hpp"
+#include "SObjA.hpp"
+#include "SObjB.hpp"
+#include "subGlobal/GObj.hpp"
int main(int argv, char** args)
{
+ subGlobal::GObj gObj;
ObjA objA;
ObjB objB;
- ObjC objC;
+ LObjA lObjA;
+ LObjB lObjB;
+ EObjA eObjA;
+ EObjB eObjB;
+ SObjA sObjA;
+ SObjB sObjB;
return 0;
}
// Header in global subdirectory
-#include "subB/moc_SubObjB.cpp"
+#include "subGlobal/moc_GObj.cpp"
diff --git a/Tests/QtAutogen/mocMacroName/CMakeLists.txt b/Tests/QtAutogen/mocMacroName/CMakeLists.txt
new file mode 100644
index 000000000..08e680314
--- /dev/null
+++ b/Tests/QtAutogen/mocMacroName/CMakeLists.txt
@@ -0,0 +1,8 @@
+cmake_minimum_required(VERSION 3.9)
+
+list(APPEND CMAKE_AUTOMOC_MACRO_NAMES "QO1_ALIAS")
+
+add_executable(mmn main.cpp Gadget.cpp Object.cpp Object1Aliased.cpp Object2Aliased.cpp)
+set_property(TARGET mmn PROPERTY AUTOMOC ON)
+set_property(TARGET mmn APPEND PROPERTY AUTOMOC_MACRO_NAMES "QO2_ALIAS")
+target_link_libraries(mmn ${QT_LIBRARIES})
diff --git a/Tests/QtAutogen/mocMacroName/CustomMacros.hpp b/Tests/QtAutogen/mocMacroName/CustomMacros.hpp
new file mode 100644
index 000000000..93e5bfdc1
--- /dev/null
+++ b/Tests/QtAutogen/mocMacroName/CustomMacros.hpp
@@ -0,0 +1,8 @@
+#ifndef CUSTOM_MACROS_HPP
+#define CUSTOM_MACROS_HPP
+
+#include <QObject>
+#define QO1_ALIAS Q_OBJECT
+#define QO2_ALIAS Q_OBJECT
+
+#endif
diff --git a/Tests/QtAutogen/mocMacroName/Gadget.cpp b/Tests/QtAutogen/mocMacroName/Gadget.cpp
new file mode 100644
index 000000000..167faebd3
--- /dev/null
+++ b/Tests/QtAutogen/mocMacroName/Gadget.cpp
@@ -0,0 +1,6 @@
+#include "Gadget.hpp"
+
+Gadget::Gadget()
+ : test(0)
+{
+}
diff --git a/Tests/QtAutogen/mocMacroName/Gadget.hpp b/Tests/QtAutogen/mocMacroName/Gadget.hpp
new file mode 100644
index 000000000..2587ed275
--- /dev/null
+++ b/Tests/QtAutogen/mocMacroName/Gadget.hpp
@@ -0,0 +1,15 @@
+#ifndef GADGET_HPP
+#define GADGET_HPP
+
+#include <QMetaType>
+
+class Gadget
+{
+ Q_GADGET
+ Q_PROPERTY(int test MEMBER test)
+public:
+ Gadget();
+ int test;
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocMacroName/Object.cpp b/Tests/QtAutogen/mocMacroName/Object.cpp
new file mode 100644
index 000000000..c0b4f33fc
--- /dev/null
+++ b/Tests/QtAutogen/mocMacroName/Object.cpp
@@ -0,0 +1,9 @@
+#include "Object.hpp"
+
+Object::Object()
+{
+}
+
+void Object::aSlot()
+{
+}
diff --git a/Tests/QtAutogen/mocMacroName/Object.hpp b/Tests/QtAutogen/mocMacroName/Object.hpp
new file mode 100644
index 000000000..0c40824ad
--- /dev/null
+++ b/Tests/QtAutogen/mocMacroName/Object.hpp
@@ -0,0 +1,19 @@
+#ifndef OBJECT_HPP
+#define OBJECT_HPP
+
+#include <QObject>
+
+class Object : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int test MEMBER test)
+public:
+ Object();
+
+ Q_SLOT
+ void aSlot();
+
+ int test;
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocMacroName/Object1Aliased.cpp b/Tests/QtAutogen/mocMacroName/Object1Aliased.cpp
new file mode 100644
index 000000000..b8b4806c6
--- /dev/null
+++ b/Tests/QtAutogen/mocMacroName/Object1Aliased.cpp
@@ -0,0 +1,9 @@
+#include "Object1Aliased.hpp"
+
+Object1Aliased::Object1Aliased()
+{
+}
+
+void Object1Aliased::aSlot()
+{
+}
diff --git a/Tests/QtAutogen/mocMacroName/Object1Aliased.hpp b/Tests/QtAutogen/mocMacroName/Object1Aliased.hpp
new file mode 100644
index 000000000..6c6bb4088
--- /dev/null
+++ b/Tests/QtAutogen/mocMacroName/Object1Aliased.hpp
@@ -0,0 +1,20 @@
+#ifndef OBJECTALIASED_HPP
+#define OBJECTALIASED_HPP
+
+#include "CustomMacros.hpp"
+
+// Test Qt object macro hidden in a macro (AUTOMOC_MACRO_NAMES)
+class Object1Aliased : public QObject
+{
+ QO1_ALIAS
+public:
+ Object1Aliased();
+
+signals:
+ void aSignal();
+
+public slots:
+ void aSlot();
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocMacroName/Object2Aliased.cpp b/Tests/QtAutogen/mocMacroName/Object2Aliased.cpp
new file mode 100644
index 000000000..4b09dd1bc
--- /dev/null
+++ b/Tests/QtAutogen/mocMacroName/Object2Aliased.cpp
@@ -0,0 +1,9 @@
+#include "Object2Aliased.hpp"
+
+Object2Aliased::Object2Aliased()
+{
+}
+
+void Object2Aliased::aSlot()
+{
+}
diff --git a/Tests/QtAutogen/mocMacroName/Object2Aliased.hpp b/Tests/QtAutogen/mocMacroName/Object2Aliased.hpp
new file mode 100644
index 000000000..b9bdc126f
--- /dev/null
+++ b/Tests/QtAutogen/mocMacroName/Object2Aliased.hpp
@@ -0,0 +1,20 @@
+#ifndef OBJECT2ALIASED_HPP
+#define OBJECT2ALIASED_HPP
+
+#include "CustomMacros.hpp"
+
+// Test Qt object macro hidden in a macro (AUTOMOC_MACRO_NAMES)
+class Object2Aliased : public QObject
+{
+ QO2_ALIAS
+public:
+ Object2Aliased();
+
+signals:
+ void aSignal();
+
+public slots:
+ void aSlot();
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocMacroName/main.cpp b/Tests/QtAutogen/mocMacroName/main.cpp
new file mode 100644
index 000000000..3b45d042d
--- /dev/null
+++ b/Tests/QtAutogen/mocMacroName/main.cpp
@@ -0,0 +1,13 @@
+#include "Gadget.hpp"
+#include "Object.hpp"
+#include "Object1Aliased.hpp"
+#include "Object2Aliased.hpp"
+
+int main(int argv, char** args)
+{
+ Gadget gadget;
+ Object object;
+ Object1Aliased object1Aliased;
+ Object2Aliased object2Aliased;
+ return 0;
+}
diff --git a/Tests/QtAutogen/mocOnlySource/StyleA.cpp b/Tests/QtAutogen/mocOnlySource/StyleA.cpp
new file mode 100644
index 000000000..ced1dd151
--- /dev/null
+++ b/Tests/QtAutogen/mocOnlySource/StyleA.cpp
@@ -0,0 +1,5 @@
+#include "StyleA.hpp"
+
+StyleA::StyleA()
+{
+}
diff --git a/Tests/QtAutogen/mocOnlySource/StyleA.hpp b/Tests/QtAutogen/mocOnlySource/StyleA.hpp
new file mode 100644
index 000000000..66735b63b
--- /dev/null
+++ b/Tests/QtAutogen/mocOnlySource/StyleA.hpp
@@ -0,0 +1,15 @@
+#ifndef STYLEA_HPP
+#define STYLEA_HPP
+
+#include <QObject>
+
+/// Q_OBJECT on a single new line
+///
+class StyleA : public QObject
+{
+ Q_OBJECT
+public:
+ StyleA();
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocOnlySource/StyleB.cpp b/Tests/QtAutogen/mocOnlySource/StyleB.cpp
new file mode 100644
index 000000000..bec6c1c36
--- /dev/null
+++ b/Tests/QtAutogen/mocOnlySource/StyleB.cpp
@@ -0,0 +1,5 @@
+#include "StyleB.hpp"
+
+StyleB::StyleB()
+{
+}
diff --git a/Tests/QtAutogen/mocOnlySource/StyleB.hpp b/Tests/QtAutogen/mocOnlySource/StyleB.hpp
new file mode 100644
index 000000000..425daf845
--- /dev/null
+++ b/Tests/QtAutogen/mocOnlySource/StyleB.hpp
@@ -0,0 +1,16 @@
+#ifndef STYLEB_HPP
+#define STYLEB_HPP
+
+#include <QObject>
+
+/* clang-format off */
+/// Q_OBJECT behind a brace
+///
+class StyleB : public QObject
+{ Q_OBJECT
+public:
+ StyleB();
+};
+/* clang-format on */
+
+#endif
diff --git a/Tests/QtAutogen/mocOnlySource/main.cpp b/Tests/QtAutogen/mocOnlySource/main.cpp
new file mode 100644
index 000000000..06f8d8106
--- /dev/null
+++ b/Tests/QtAutogen/mocOnlySource/main.cpp
@@ -0,0 +1,9 @@
+#include "StyleA.hpp"
+#include "StyleB.hpp"
+
+int main(int argv, char** args)
+{
+ StyleA styleA;
+ StyleB styleB;
+ return 0;
+}
diff --git a/Tests/QtAutogen/mocPlugin/CMakeLists.txt b/Tests/QtAutogen/mocPlugin/CMakeLists.txt
deleted file mode 100644
index f80aa2934..000000000
--- a/Tests/QtAutogen/mocPlugin/CMakeLists.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-cmake_minimum_required(VERSION 3.8)
-project(mocPlugin CXX)
-
-set(CMAKE_AUTOMOC_DEPEND_FILTERS
- "A_CUSTOM_MACRO"
- "[\n][ \t]*A_CUSTOM_MACRO[ \t\r\n]*\\([^,]+,[ \t\r\n]*\"([^\"]+)\""
- )
-
-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()
-
-configure_file(jsonIn/StyleC.json jsonFiles/StyleC.json)
-configure_file(jsonIn/StyleD.json jsonFiles/sub/StyleD.json)
-configure_file(jsonIn/StyleC.json jsonFiles/StyleC_Custom.json)
-configure_file(jsonIn/StyleD.json jsonFiles/sub/StyleD_Custom.json)
-
-# Enable automoc
-set(CMAKE_AUTOMOC TRUE)
-
-include_directories("${CMAKE_CURRENT_BINARY_DIR}/jsonFiles")
-link_libraries(Qt5::Widgets)
-
-add_library(PlugA STATIC StyleA.cpp)
-add_library(PlugB STATIC StyleB.cpp)
-add_library(PlugC STATIC StyleC.cpp)
-add_library(PlugD STATIC StyleD.cpp)
-add_library(PlugE STATIC StyleE.cpp)
diff --git a/Tests/QtAutogen/mocPlugin/StyleA.cpp b/Tests/QtAutogen/mocPlugin/StyleA.cpp
deleted file mode 100644
index b5e87533c..000000000
--- a/Tests/QtAutogen/mocPlugin/StyleA.cpp
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "StyleA.hpp"
-
-QStyle* StyleA::create(const QString& key)
-{
- return 0;
-}
diff --git a/Tests/QtAutogen/mocPlugin/StyleA.hpp b/Tests/QtAutogen/mocPlugin/StyleA.hpp
deleted file mode 100644
index 1b6154d16..000000000
--- a/Tests/QtAutogen/mocPlugin/StyleA.hpp
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef STYLEA_HPP
-#define STYLEA_HPP
-
-#include "StyleCommon.hpp"
-#include <QStylePlugin>
-
-class StyleA : public QStylePlugin
-{
- Q_OBJECT
- // Json file in local directory
- Q_PLUGIN_METADATA(IID "org.styles.A" FILE "StyleA.json")
- A_CUSTOM_MACRO(SomeArg, "StyleA_Custom.json", AnotherArg)
-public:
- QStyle* create(const QString& key);
-};
-
-#endif
diff --git a/Tests/QtAutogen/mocPlugin/StyleA.json b/Tests/QtAutogen/mocPlugin/StyleA.json
deleted file mode 100644
index cc3395369..000000000
--- a/Tests/QtAutogen/mocPlugin/StyleA.json
+++ /dev/null
@@ -1 +0,0 @@
-{ "Keys": [ "Rocket", "Starbuster" ] }
diff --git a/Tests/QtAutogen/mocPlugin/StyleA_Custom.json b/Tests/QtAutogen/mocPlugin/StyleA_Custom.json
deleted file mode 100644
index cc3395369..000000000
--- a/Tests/QtAutogen/mocPlugin/StyleA_Custom.json
+++ /dev/null
@@ -1 +0,0 @@
-{ "Keys": [ "Rocket", "Starbuster" ] }
diff --git a/Tests/QtAutogen/mocPlugin/StyleB.cpp b/Tests/QtAutogen/mocPlugin/StyleB.cpp
deleted file mode 100644
index 17d440035..000000000
--- a/Tests/QtAutogen/mocPlugin/StyleB.cpp
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "StyleB.hpp"
-
-QStyle* StyleB::create(const QString& key)
-{
- return 0;
-}
diff --git a/Tests/QtAutogen/mocPlugin/StyleB.hpp b/Tests/QtAutogen/mocPlugin/StyleB.hpp
deleted file mode 100644
index 163c9b20a..000000000
--- a/Tests/QtAutogen/mocPlugin/StyleB.hpp
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef STYLEB_HPP
-#define STYLEB_HPP
-
-#include "StyleCommon.hpp"
-#include <QStylePlugin>
-
-class StyleB : public QStylePlugin
-{
- Q_OBJECT
- // Json file in local subdirectory
- Q_PLUGIN_METADATA(IID "org.styles.B" FILE "jsonIn/StyleB.json")
- A_CUSTOM_MACRO(SomeArg, "jsonIn/StyleB_Custom.json", AnotherArg)
-public:
- QStyle* create(const QString& key);
-};
-
-#endif
diff --git a/Tests/QtAutogen/mocPlugin/StyleC.cpp b/Tests/QtAutogen/mocPlugin/StyleC.cpp
deleted file mode 100644
index 37e756487..000000000
--- a/Tests/QtAutogen/mocPlugin/StyleC.cpp
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "StyleC.hpp"
-
-QStyle* StyleC::create(const QString& key)
-{
- return 0;
-}
diff --git a/Tests/QtAutogen/mocPlugin/StyleC.hpp b/Tests/QtAutogen/mocPlugin/StyleC.hpp
deleted file mode 100644
index 52a887acf..000000000
--- a/Tests/QtAutogen/mocPlugin/StyleC.hpp
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef STYLEC_HPP
-#define STYLEC_HPP
-
-#include "StyleCommon.hpp"
-#include <QStylePlugin>
-
-class StyleC : public QStylePlugin
-{
- Q_OBJECT
- // Json file in global root directory
- Q_PLUGIN_METADATA(IID "org.styles.C" FILE "StyleC.json")
- A_CUSTOM_MACRO(SomeArg, "StyleC_Custom.json", AnotherArg)
-public:
- QStyle* create(const QString& key);
-};
-
-#endif
diff --git a/Tests/QtAutogen/mocPlugin/StyleCommon.hpp b/Tests/QtAutogen/mocPlugin/StyleCommon.hpp
deleted file mode 100644
index f1a7ec60d..000000000
--- a/Tests/QtAutogen/mocPlugin/StyleCommon.hpp
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef STYLECOMMON_HPP
-#define STYLECOMMON_HPP
-
-// Empty test macro definition
-#define A_CUSTOM_MACRO(name, jsonFile, pluginRegistrations)
-
-#endif
diff --git a/Tests/QtAutogen/mocPlugin/StyleD.cpp b/Tests/QtAutogen/mocPlugin/StyleD.cpp
deleted file mode 100644
index 7e4b121fc..000000000
--- a/Tests/QtAutogen/mocPlugin/StyleD.cpp
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "StyleD.hpp"
-
-QStyle* StyleD::create(const QString& key)
-{
- return 0;
-}
diff --git a/Tests/QtAutogen/mocPlugin/StyleD.hpp b/Tests/QtAutogen/mocPlugin/StyleD.hpp
deleted file mode 100644
index df8a4399d..000000000
--- a/Tests/QtAutogen/mocPlugin/StyleD.hpp
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef STYLED_HPP
-#define STYLED_HPP
-
-#include "StyleCommon.hpp"
-#include <QStylePlugin>
-
-class StyleD : public QStylePlugin
-{
- Q_OBJECT
- // Json file in global sub director
- Q_PLUGIN_METADATA(IID "org.styles.D" FILE "sub/StyleD.json")
- A_CUSTOM_MACRO(SomeArg, "sub/StyleD_Custom.json", AnotherArg)
-public:
- QStyle* create(const QString& key);
-};
-
-#endif
diff --git a/Tests/QtAutogen/mocPlugin/StyleE.cpp b/Tests/QtAutogen/mocPlugin/StyleE.cpp
deleted file mode 100644
index 8fc9a7f68..000000000
--- a/Tests/QtAutogen/mocPlugin/StyleE.cpp
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "StyleE.hpp"
-
-QStyle* StyleE::create(const QString& key)
-{
- return 0;
-}
diff --git a/Tests/QtAutogen/mocPlugin/StyleE.hpp b/Tests/QtAutogen/mocPlugin/StyleE.hpp
deleted file mode 100644
index e7915a8e5..000000000
--- a/Tests/QtAutogen/mocPlugin/StyleE.hpp
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef STYLEE_HPP
-#define STYLEE_HPP
-
-#include "StyleCommon.hpp"
-#include <QStylePlugin>
-
-class StyleE : public QStylePlugin
-{
- Q_OBJECT
- // No Json file
- Q_PLUGIN_METADATA(IID "org.styles.E")
- A_CUSTOM_MACRO(SomeArg, InvalidFileArg, AnotherArg)
-public:
- QStyle* create(const QString& key);
-};
-
-#endif
diff --git a/Tests/QtAutogen/mocPlugin/jsonIn/StyleB.json b/Tests/QtAutogen/mocPlugin/jsonIn/StyleB.json
deleted file mode 100644
index 129cac41f..000000000
--- a/Tests/QtAutogen/mocPlugin/jsonIn/StyleB.json
+++ /dev/null
@@ -1 +0,0 @@
-{ "Keys": [ "Rocket", "StarbusterB" ] }
diff --git a/Tests/QtAutogen/mocPlugin/jsonIn/StyleB_Custom.json b/Tests/QtAutogen/mocPlugin/jsonIn/StyleB_Custom.json
deleted file mode 100644
index 129cac41f..000000000
--- a/Tests/QtAutogen/mocPlugin/jsonIn/StyleB_Custom.json
+++ /dev/null
@@ -1 +0,0 @@
-{ "Keys": [ "Rocket", "StarbusterB" ] }
diff --git a/Tests/QtAutogen/mocPlugin/jsonIn/StyleC.json b/Tests/QtAutogen/mocPlugin/jsonIn/StyleC.json
deleted file mode 100644
index 119aaa4b7..000000000
--- a/Tests/QtAutogen/mocPlugin/jsonIn/StyleC.json
+++ /dev/null
@@ -1 +0,0 @@
-{ "Keys": [ "Boat", "Ship" ] }
diff --git a/Tests/QtAutogen/mocPlugin/jsonIn/StyleD.json b/Tests/QtAutogen/mocPlugin/jsonIn/StyleD.json
deleted file mode 100644
index 732c547ab..000000000
--- a/Tests/QtAutogen/mocPlugin/jsonIn/StyleD.json
+++ /dev/null
@@ -1 +0,0 @@
-{ "Keys": [ "Bike", "Car" ] }
diff --git a/Tests/QtAutogen/mocRerun/CMakeLists.txt b/Tests/QtAutogen/mocRerun/CMakeLists.txt
deleted file mode 100644
index 14b077b38..000000000
--- a/Tests/QtAutogen/mocRerun/CMakeLists.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-cmake_minimum_required(VERSION 3.7)
-project(mocRerun CXX)
-
-if (QT_TEST_VERSION STREQUAL 4)
- find_package(Qt4 REQUIRED)
- set(QT_CORE_TARGET Qt4::QtCore)
-else()
- if (NOT QT_TEST_VERSION STREQUAL 5)
- message(SEND_ERROR "Invalid Qt version specified.")
- endif()
-
- find_package(Qt5Core REQUIRED)
- set(QT_CORE_TARGET Qt5::Core)
-endif()
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-
-# Generated source file
-add_custom_command(OUTPUT main.cpp
- COMMAND ${CMAKE_COMMAND} -E sleep 2
- COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/main.cpp
- )
-
-add_executable(mocRerun
- ${CMAKE_CURRENT_BINARY_DIR}/test1.h
- ${CMAKE_CURRENT_BINARY_DIR}/main.cpp
- res1.qrc
- )
-set_property(TARGET mocRerun PROPERTY __UNDOCUMENTED_AUTOGEN_GENERATED_FILES 1)
-target_include_directories(mocRerun PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
-target_link_libraries(mocRerun ${QT_CORE_TARGET})
-# Write target name to text file
-add_custom_command(TARGET mocRerun POST_BUILD COMMAND
- ${CMAKE_COMMAND} -E echo "$<TARGET_FILE:mocRerun>" > target1.txt)
diff --git a/Tests/QtAutogen/mocRerun/input.txt b/Tests/QtAutogen/mocRerun/input.txt
deleted file mode 100644
index da627624b..000000000
--- a/Tests/QtAutogen/mocRerun/input.txt
+++ /dev/null
@@ -1 +0,0 @@
-Res1 input.
diff --git a/Tests/QtAutogen/mocRerun/main.cpp.in b/Tests/QtAutogen/mocRerun/main.cpp.in
deleted file mode 100644
index b37ff61e2..000000000
--- a/Tests/QtAutogen/mocRerun/main.cpp.in
+++ /dev/null
@@ -1,18 +0,0 @@
-#include "test1.h"
-
-class Test2 : public QObject
-{
- Q_OBJECT
-public slots:
- void onTst1() {}
-};
-
-int main()
-{
- Test1 test1;
- Test2 test2;
-
- return 0;
-}
-
-#include "main.moc"
diff --git a/Tests/QtAutogen/mocRerun/res1.qrc b/Tests/QtAutogen/mocRerun/res1.qrc
deleted file mode 100644
index fb804b5ec..000000000
--- a/Tests/QtAutogen/mocRerun/res1.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>input.txt</file>
- </qresource>
-</RCC>
diff --git a/Tests/QtAutogen/mocRerun/test1a.h.in b/Tests/QtAutogen/mocRerun/test1a.h.in
deleted file mode 100644
index a335046ba..000000000
--- a/Tests/QtAutogen/mocRerun/test1a.h.in
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <QObject>
-class Test1 : public QObject
-{
- Q_OBJECT
-public slots:
- void onTst1() {}
- void onTst2() {}
-};
diff --git a/Tests/QtAutogen/mocRerun/test1b.h.in b/Tests/QtAutogen/mocRerun/test1b.h.in
deleted file mode 100644
index 6128eeba1..000000000
--- a/Tests/QtAutogen/mocRerun/test1b.h.in
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <QObject>
-class Test1 : public QObject
-{
- Q_OBJECT
-public slots:
- void onTst1() {}
-};
diff --git a/Tests/QtAutogen/objectLibrary/CMakeLists.txt b/Tests/QtAutogen/objectLibrary/CMakeLists.txt
new file mode 100644
index 000000000..9b29a4075
--- /dev/null
+++ b/Tests/QtAutogen/objectLibrary/CMakeLists.txt
@@ -0,0 +1,14 @@
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+set(CMAKE_AUTOMOC ON)
+
+# Object library a defined in a subdirectory
+add_subdirectory(a)
+
+# Object library b defined locally
+include_directories(b)
+add_library(b OBJECT b/classb.cpp)
+target_compile_features(b PRIVATE ${QT_COMPILE_FEATURES})
+
+# Executable with OBJECT library generator expressions
+add_executable(someProgram main.cpp $<TARGET_OBJECTS:a> $<TARGET_OBJECTS:b>)
+target_link_libraries(someProgram ${QT_LIBRARIES})
diff --git a/Tests/QtAutogen/objectLibrary/a/CMakeLists.txt b/Tests/QtAutogen/objectLibrary/a/CMakeLists.txt
new file mode 100644
index 000000000..fe76ac32c
--- /dev/null
+++ b/Tests/QtAutogen/objectLibrary/a/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_library(a OBJECT classa.cpp)
+target_compile_features(a PRIVATE ${QT_COMPILE_FEATURES})
diff --git a/Tests/QtAutogen/objectLibrary/a/classa.cpp b/Tests/QtAutogen/objectLibrary/a/classa.cpp
new file mode 100644
index 000000000..4f08fda84
--- /dev/null
+++ b/Tests/QtAutogen/objectLibrary/a/classa.cpp
@@ -0,0 +1,7 @@
+#include "classa.h"
+#include <QDebug>
+
+void ClassA::slotDoSomething()
+{
+ qDebug() << m_member;
+}
diff --git a/Tests/QtAutogen/objectLibrary/a/classa.h b/Tests/QtAutogen/objectLibrary/a/classa.h
new file mode 100644
index 000000000..fa5fed941
--- /dev/null
+++ b/Tests/QtAutogen/objectLibrary/a/classa.h
@@ -0,0 +1,23 @@
+#ifndef CLASSA_H
+#define CLASSA_H
+
+#include <QObject>
+#include <QString>
+
+class ClassA : public QObject
+{
+ Q_OBJECT
+public:
+ ClassA()
+ : m_member("Hello A")
+ {
+ }
+
+public slots:
+ void slotDoSomething();
+
+private:
+ QString m_member;
+};
+
+#endif
diff --git a/Tests/QtAutogen/objectLibrary/b/classb.cpp b/Tests/QtAutogen/objectLibrary/b/classb.cpp
new file mode 100644
index 000000000..26e09261c
--- /dev/null
+++ b/Tests/QtAutogen/objectLibrary/b/classb.cpp
@@ -0,0 +1,7 @@
+#include "classb.h"
+#include <QDebug>
+
+void ClassB::slotDoSomething()
+{
+ qDebug() << m_member;
+}
diff --git a/Tests/QtAutogen/objectLibrary/b/classb.h b/Tests/QtAutogen/objectLibrary/b/classb.h
new file mode 100644
index 000000000..783bb48ce
--- /dev/null
+++ b/Tests/QtAutogen/objectLibrary/b/classb.h
@@ -0,0 +1,23 @@
+#ifndef CLASSB_H
+#define CLASSB_H
+
+#include <QObject>
+#include <QString>
+
+class ClassB : public QObject
+{
+ Q_OBJECT
+public:
+ ClassB()
+ : m_member("Hello B")
+ {
+ }
+
+public slots:
+ void slotDoSomething();
+
+private:
+ QString m_member;
+};
+
+#endif
diff --git a/Tests/QtAutogen/objectLibrary/main.cpp b/Tests/QtAutogen/objectLibrary/main.cpp
new file mode 100644
index 000000000..cacf0fdae
--- /dev/null
+++ b/Tests/QtAutogen/objectLibrary/main.cpp
@@ -0,0 +1,13 @@
+#include "a/classa.h"
+#include "b/classb.h"
+
+int main(int argc, char** argv)
+{
+ ClassA a;
+ a.slotDoSomething();
+
+ ClassB b;
+ b.slotDoSomething();
+
+ return 0;
+}
diff --git a/Tests/QtAutogen/rccDepends/CMakeLists.txt b/Tests/QtAutogen/rccDepends/CMakeLists.txt
deleted file mode 100644
index 878ae5d35..000000000
--- a/Tests/QtAutogen/rccDepends/CMakeLists.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-cmake_minimum_required(VERSION 3.7)
-project(rccDepends)
-
-set(CMAKE_AUTORCC ON)
-
-if (QT_TEST_VERSION STREQUAL 4)
- find_package(Qt4 REQUIRED)
- set(QT_CORE_TARGET Qt4::QtCore)
-else()
- if (NOT QT_TEST_VERSION STREQUAL 5)
- message(SEND_ERROR "Invalid Qt version specified.")
- endif()
-
- find_package(Qt5Core REQUIRED)
- set(QT_CORE_TARGET Qt5::Core)
-endif()
-
-configure_file(res/input1.txt.in res1/input.txt COPYONLY)
-configure_file(res/input1.txt.in res1/inputAdded.txt COPYONLY)
-configure_file(res/input2.txt.in res2/input.txt COPYONLY)
-configure_file(res/input2.txt.in res2/inputAdded.txt COPYONLY)
-# Dependency generated qrc file
-add_custom_command(OUTPUT res2.qrc
- DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/res2.qrc.in
- COMMAND ${CMAKE_COMMAND} -E sleep 2
- COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/res2.qrc.in ${CMAKE_CURRENT_BINARY_DIR}/res2.qrc
- )
-
-add_executable(rccDepends
- main.cpp
- ${CMAKE_CURRENT_BINARY_DIR}/res1.qrc
- ${CMAKE_CURRENT_BINARY_DIR}/res2.qrc )
-target_link_libraries(rccDepends ${QT_CORE_TARGET})
-add_custom_command(TARGET rccDepends POST_BUILD COMMAND
- ${CMAKE_COMMAND} -E echo "$<TARGET_FILE:rccDepends>" > target.txt)
diff --git a/Tests/QtAutogen/rccDepends/main.cpp b/Tests/QtAutogen/rccDepends/main.cpp
deleted file mode 100644
index 766b7751b..000000000
--- a/Tests/QtAutogen/rccDepends/main.cpp
+++ /dev/null
@@ -1,5 +0,0 @@
-
-int main()
-{
- return 0;
-}
diff --git a/Tests/QtAutogen/rccDepends/res/input1.txt.in b/Tests/QtAutogen/rccDepends/res/input1.txt.in
deleted file mode 100644
index da627624b..000000000
--- a/Tests/QtAutogen/rccDepends/res/input1.txt.in
+++ /dev/null
@@ -1 +0,0 @@
-Res1 input.
diff --git a/Tests/QtAutogen/rccDepends/res/input2.txt.in b/Tests/QtAutogen/rccDepends/res/input2.txt.in
deleted file mode 100644
index 08e14b7bd..000000000
--- a/Tests/QtAutogen/rccDepends/res/input2.txt.in
+++ /dev/null
@@ -1 +0,0 @@
-Res2 input.
diff --git a/Tests/QtAutogen/rccDepends/res1a.qrc.in b/Tests/QtAutogen/rccDepends/res1a.qrc.in
deleted file mode 100644
index d111ffbc7..000000000
--- a/Tests/QtAutogen/rccDepends/res1a.qrc.in
+++ /dev/null
@@ -1,5 +0,0 @@
-<RCC>
- <qresource prefix="/Texts1">
- <file>res1/input.txt</file>
- </qresource>
-</RCC>
diff --git a/Tests/QtAutogen/rccDepends/res1b.qrc.in b/Tests/QtAutogen/rccDepends/res1b.qrc.in
deleted file mode 100644
index 4cb3f047c..000000000
--- a/Tests/QtAutogen/rccDepends/res1b.qrc.in
+++ /dev/null
@@ -1,6 +0,0 @@
-<RCC>
- <qresource prefix="/Texts1">
- <file>res1/input.txt</file>
- <file alias="Added">res1/inputAdded.txt</file>
- </qresource>
-</RCC>
diff --git a/Tests/QtAutogen/rccDepends/res2a.qrc.in b/Tests/QtAutogen/rccDepends/res2a.qrc.in
deleted file mode 100644
index 19f34ac90..000000000
--- a/Tests/QtAutogen/rccDepends/res2a.qrc.in
+++ /dev/null
@@ -1,5 +0,0 @@
-<RCC>
- <qresource prefix="/Texts2">
- <file>res2/input.txt</file>
- </qresource>
-</RCC>
diff --git a/Tests/QtAutogen/rccDepends/res2b.qrc.in b/Tests/QtAutogen/rccDepends/res2b.qrc.in
deleted file mode 100644
index 19e8ba10c..000000000
--- a/Tests/QtAutogen/rccDepends/res2b.qrc.in
+++ /dev/null
@@ -1,6 +0,0 @@
-<RCC>
- <qresource prefix="/Texts2">
- <file>res2/input.txt</file>
- <file alias="Added">res2/inputAdded.txt</file>
- </qresource>
-</RCC>
diff --git a/Tests/QtAutogen/sameName/CMakeLists.txt b/Tests/QtAutogen/sameName/CMakeLists.txt
index 4d2dcd9d2..f695875cb 100644
--- a/Tests/QtAutogen/sameName/CMakeLists.txt
+++ b/Tests/QtAutogen/sameName/CMakeLists.txt
@@ -17,7 +17,10 @@ add_executable(sameName
main.cpp
)
target_link_libraries(sameName ${QT_LIBRARIES})
-set_target_properties(sameName PROPERTIES AUTOMOC TRUE AUTORCC TRUE)
+set_target_properties(sameName PROPERTIES
+ AUTOMOC TRUE
+ AUTOUIC TRUE
+ AUTORCC TRUE)
# Set different compression levels
if (QT_TEST_VERSION STREQUAL 4)
diff --git a/Tests/QtAutogen/sameName/aaa/bbb/item.cpp b/Tests/QtAutogen/sameName/aaa/bbb/item.cpp
index 20d00445e..850206f6b 100644
--- a/Tests/QtAutogen/sameName/aaa/bbb/item.cpp
+++ b/Tests/QtAutogen/sameName/aaa/bbb/item.cpp
@@ -3,8 +3,20 @@
namespace aaa {
namespace bbb {
+class MocLocal : public QObject
+{
+ Q_OBJECT;
+
+public:
+ MocLocal() = default;
+ ~MocLocal() = default;
+};
+
void Item::go()
{
+ MocLocal obj;
}
}
}
+
+#include "aaa/bbb/item.moc"
diff --git a/Tests/QtAutogen/sameName/aaa/item.cpp b/Tests/QtAutogen/sameName/aaa/item.cpp
index 95dd3b674..e35d3d128 100644
--- a/Tests/QtAutogen/sameName/aaa/item.cpp
+++ b/Tests/QtAutogen/sameName/aaa/item.cpp
@@ -1,8 +1,22 @@
#include "item.hpp"
+// Include ui_view.h only in header
namespace aaa {
+class MocLocal : public QObject
+{
+ Q_OBJECT;
+
+public:
+ MocLocal() = default;
+ ~MocLocal() = default;
+};
+
void Item::go()
{
+ Ui_ViewAAA ui;
+ MocLocal obj;
}
}
+
+#include "aaa/item.moc"
diff --git a/Tests/QtAutogen/sameName/aaa/item.hpp b/Tests/QtAutogen/sameName/aaa/item.hpp
index b63466f6d..875f72fdb 100644
--- a/Tests/QtAutogen/sameName/aaa/item.hpp
+++ b/Tests/QtAutogen/sameName/aaa/item.hpp
@@ -2,6 +2,8 @@
#define AAA_ITEM_HPP
#include <QObject>
+// Include ui_view.h only in header
+#include <aaa/ui_view.h>
namespace aaa {
diff --git a/Tests/QtAutogen/sameName/aaa/view.ui b/Tests/QtAutogen/sameName/aaa/view.ui
new file mode 100644
index 000000000..0f0998006
--- /dev/null
+++ b/Tests/QtAutogen/sameName/aaa/view.ui
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ViewAAA</class>
+ <widget class="QWidget" name="Base">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QTreeView" name="treeView"/>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/Tests/QtAutogen/sameName/bbb/aaa/item.cpp b/Tests/QtAutogen/sameName/bbb/aaa/item.cpp
index ac4b2c27b..7ad01c3ef 100644
--- a/Tests/QtAutogen/sameName/bbb/aaa/item.cpp
+++ b/Tests/QtAutogen/sameName/bbb/aaa/item.cpp
@@ -3,8 +3,20 @@
namespace bbb {
namespace aaa {
+class MocLocal : public QObject
+{
+ Q_OBJECT;
+
+public:
+ MocLocal() = default;
+ ~MocLocal() = default;
+};
+
void Item::go()
{
+ MocLocal obj;
}
}
}
+
+#include "bbb/aaa/item.moc"
diff --git a/Tests/QtAutogen/sameName/bbb/item.cpp b/Tests/QtAutogen/sameName/bbb/item.cpp
index f97a1431e..9ef128ed0 100644
--- a/Tests/QtAutogen/sameName/bbb/item.cpp
+++ b/Tests/QtAutogen/sameName/bbb/item.cpp
@@ -1,8 +1,23 @@
#include "item.hpp"
+// Include ui_view.h only in source
+#include <bbb/ui_view.h>
namespace bbb {
+class MocLocal : public QObject
+{
+ Q_OBJECT;
+
+public:
+ MocLocal() = default;
+ ~MocLocal() = default;
+};
+
void Item::go()
{
+ Ui_ViewBBB ui;
+ MocLocal obj;
}
}
+
+#include "bbb/item.moc"
diff --git a/Tests/QtAutogen/sameName/bbb/item.hpp b/Tests/QtAutogen/sameName/bbb/item.hpp
index 5b7f9850b..d39a9d711 100644
--- a/Tests/QtAutogen/sameName/bbb/item.hpp
+++ b/Tests/QtAutogen/sameName/bbb/item.hpp
@@ -2,6 +2,7 @@
#define BBB_ITEM_HPP
#include <QObject>
+// Include ui_view.h only in source
namespace bbb {
diff --git a/Tests/QtAutogen/sameName/bbb/view.ui b/Tests/QtAutogen/sameName/bbb/view.ui
new file mode 100644
index 000000000..a8f506e88
--- /dev/null
+++ b/Tests/QtAutogen/sameName/bbb/view.ui
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ViewBBB</class>
+ <widget class="QWidget" name="Base">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QTreeView" name="treeView"/>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/Tests/QtAutogen/sameName/ccc/item.cpp b/Tests/QtAutogen/sameName/ccc/item.cpp
index d90b2b8c7..ab8a2817b 100644
--- a/Tests/QtAutogen/sameName/ccc/item.cpp
+++ b/Tests/QtAutogen/sameName/ccc/item.cpp
@@ -1,23 +1,25 @@
#include "item.hpp"
+// Include ui_view.h in source and header
+#include <ccc/ui_view.h>
namespace ccc {
-void Item::go()
-{
-}
-
-class MocTest : public QObject
+class MocLocal : public QObject
{
Q_OBJECT;
- Q_SLOT
- void go();
+
+public:
+ MocLocal() = default;
+ ~MocLocal() = default;
};
-void MocTest::go()
+void Item::go()
{
+ Ui_ViewCCC ui;
+ MocLocal obj;
}
}
// Include own moc files
-#include "item.moc"
+#include "ccc/item.moc"
#include "moc_item.cpp"
diff --git a/Tests/QtAutogen/sameName/ccc/item.hpp b/Tests/QtAutogen/sameName/ccc/item.hpp
index 96fcc245c..20d9dd978 100644
--- a/Tests/QtAutogen/sameName/ccc/item.hpp
+++ b/Tests/QtAutogen/sameName/ccc/item.hpp
@@ -2,6 +2,8 @@
#define CCC_ITEM_HPP
#include <QObject>
+// Include ui_view.h in source and header
+#include <ccc/ui_view.h>
namespace ccc {
diff --git a/Tests/QtAutogen/sameName/ccc/view.ui b/Tests/QtAutogen/sameName/ccc/view.ui
new file mode 100644
index 000000000..7989c6973
--- /dev/null
+++ b/Tests/QtAutogen/sameName/ccc/view.ui
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ViewCCC</class>
+ <widget class="QWidget" name="Base">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QTreeView" name="treeView"/>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/Tests/QtAutogen/sameName/item.cpp b/Tests/QtAutogen/sameName/item.cpp
index e013cf392..3d1fbe7cf 100644
--- a/Tests/QtAutogen/sameName/item.cpp
+++ b/Tests/QtAutogen/sameName/item.cpp
@@ -1,5 +1,20 @@
#include "item.hpp"
+// Include ui_view.h in source and header
+#include <ui_view.h>
+
+class MocLocal : public QObject
+{
+ Q_OBJECT;
+
+public:
+ MocLocal() = default;
+ ~MocLocal() = default;
+};
void Item::go()
{
+ Ui_View ui;
+ MocLocal obj;
}
+
+#include "item.moc"
diff --git a/Tests/QtAutogen/sameName/item.hpp b/Tests/QtAutogen/sameName/item.hpp
index 91bba3b4d..75e83f483 100644
--- a/Tests/QtAutogen/sameName/item.hpp
+++ b/Tests/QtAutogen/sameName/item.hpp
@@ -2,6 +2,8 @@
#define ITEM_HPP
#include <QObject>
+// Include ui_view.h in source and header
+#include <ui_view.h>
class Item : public QObject
{
diff --git a/Tests/QtAutogen/sameName/view.ui b/Tests/QtAutogen/sameName/view.ui
new file mode 100644
index 000000000..2ffe7344c
--- /dev/null
+++ b/Tests/QtAutogen/sameName/view.ui
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>View</class>
+ <widget class="QWidget" name="Base">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QTreeView" name="treeView"/>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/Tests/QtAutogen/skipMoc.cpp b/Tests/QtAutogen/skipMoc.cpp
index 85305f590..d6b292ff3 100644
--- a/Tests/QtAutogen/skipMoc.cpp
+++ b/Tests/QtAutogen/skipMoc.cpp
@@ -2,12 +2,14 @@
#include "skipSource/qItemA.hpp"
#include "skipSource/qItemB.hpp"
#include "skipSource/qItemC.hpp"
+#include "skipSource/qItemD.hpp"
int main(int, char**)
{
QItemA itemA;
- QItemA itemB;
- QItemA itemC;
+ QItemB itemB;
+ QItemC itemC;
+ QItemD itemD;
// Fails to link if the symbol is not present.
return 0;
diff --git a/Tests/QtAutogen/skipSource/qItemC.cpp b/Tests/QtAutogen/skipSource/qItemC.cpp
index 700abd6db..622f2829e 100644
--- a/Tests/QtAutogen/skipSource/qItemC.cpp
+++ b/Tests/QtAutogen/skipSource/qItemC.cpp
@@ -1,5 +1,17 @@
#include "qItemC.hpp"
+class QItemC_Local : public QObject
+{
+ Q_OBJECT
+public:
+ QItemC_Local(){};
+ ~QItemC_Local(){};
+};
+
void QItemC::go()
{
+ QItemC_Local localObject;
}
+
+// We need AUTOMOC processing
+#include "qItemC.moc"
diff --git a/Tests/QtAutogen/skipSource/qItemD.cpp b/Tests/QtAutogen/skipSource/qItemD.cpp
new file mode 100644
index 000000000..fe0f4e4da
--- /dev/null
+++ b/Tests/QtAutogen/skipSource/qItemD.cpp
@@ -0,0 +1,17 @@
+#include "qItemD.hpp"
+
+class QItemD_Local : public QObject
+{
+ Q_OBJECT
+public:
+ QItemD_Local(){};
+ ~QItemD_Local(){};
+};
+
+void QItemD::go()
+{
+ QItemD_Local localObject;
+}
+
+// We need AUTOMOC processing
+#include "qItemD.moc"
diff --git a/Tests/QtAutogen/skipSource/qItemD.hpp b/Tests/QtAutogen/skipSource/qItemD.hpp
new file mode 100644
index 000000000..99e0acbed
--- /dev/null
+++ b/Tests/QtAutogen/skipSource/qItemD.hpp
@@ -0,0 +1,13 @@
+#ifndef QITEMD_HPP
+#define QITEMD_HPP
+
+#include <QObject>
+
+class QItemD : public QObject
+{
+ Q_OBJECT
+ Q_SLOT
+ void go();
+};
+
+#endif
diff --git a/Tests/QtAutogen/staticLibraryCycle/CMakeLists.txt b/Tests/QtAutogen/staticLibraryCycle/CMakeLists.txt
new file mode 100644
index 000000000..144a435f4
--- /dev/null
+++ b/Tests/QtAutogen/staticLibraryCycle/CMakeLists.txt
@@ -0,0 +1,17 @@
+# Test AUTOMOC and AUTORCC on source files with the same name
+# but in different subdirectories
+
+set(CMAKE_AUTOMOC ON)
+
+# Cyclic static libraries
+add_library(slc_a STATIC a.cpp)
+target_link_libraries(slc_a ${QT_LIBRARIES} slc_b)
+
+add_library(slc_b STATIC b.cpp)
+target_link_libraries(slc_b ${QT_LIBRARIES} slc_c)
+
+add_library(slc_c STATIC c.cpp)
+target_link_libraries(slc_c ${QT_LIBRARIES} slc_a)
+
+add_executable(slc main.cpp)
+target_link_libraries(slc ${QT_LIBRARIES} slc_a)
diff --git a/Tests/QtAutogen/staticLibraryCycle/a.cpp b/Tests/QtAutogen/staticLibraryCycle/a.cpp
new file mode 100644
index 000000000..97cc66e2d
--- /dev/null
+++ b/Tests/QtAutogen/staticLibraryCycle/a.cpp
@@ -0,0 +1,7 @@
+#include "a.h"
+#include "b.h"
+
+A::A()
+{
+ B b;
+}
diff --git a/Tests/QtAutogen/staticLibraryCycle/a.h b/Tests/QtAutogen/staticLibraryCycle/a.h
new file mode 100644
index 000000000..71761708b
--- /dev/null
+++ b/Tests/QtAutogen/staticLibraryCycle/a.h
@@ -0,0 +1,13 @@
+#ifndef CLASSA_HPP
+#define CLASSA_HPP
+
+#include <QObject>
+
+class A : public QObject
+{
+ Q_OBJECT
+public:
+ A();
+};
+
+#endif
diff --git a/Tests/QtAutogen/staticLibraryCycle/b.cpp b/Tests/QtAutogen/staticLibraryCycle/b.cpp
new file mode 100644
index 000000000..a807d89cf
--- /dev/null
+++ b/Tests/QtAutogen/staticLibraryCycle/b.cpp
@@ -0,0 +1,7 @@
+#include "b.h"
+#include "c.h"
+
+B::B()
+{
+ C c;
+}
diff --git a/Tests/QtAutogen/staticLibraryCycle/b.h b/Tests/QtAutogen/staticLibraryCycle/b.h
new file mode 100644
index 000000000..ededbd803
--- /dev/null
+++ b/Tests/QtAutogen/staticLibraryCycle/b.h
@@ -0,0 +1,13 @@
+#ifndef CLASSB_HPP
+#define CLASSB_HPP
+
+#include <QObject>
+
+class B : public QObject
+{
+ Q_OBJECT
+public:
+ B();
+};
+
+#endif
diff --git a/Tests/QtAutogen/staticLibraryCycle/c.cpp b/Tests/QtAutogen/staticLibraryCycle/c.cpp
new file mode 100644
index 000000000..7d427c234
--- /dev/null
+++ b/Tests/QtAutogen/staticLibraryCycle/c.cpp
@@ -0,0 +1,7 @@
+#include "c.h"
+#include "a.h"
+
+C::C()
+{
+ A a;
+}
diff --git a/Tests/QtAutogen/staticLibraryCycle/c.h b/Tests/QtAutogen/staticLibraryCycle/c.h
new file mode 100644
index 000000000..20f3725e9
--- /dev/null
+++ b/Tests/QtAutogen/staticLibraryCycle/c.h
@@ -0,0 +1,13 @@
+#ifndef CLASSC_HPP
+#define CLASSC_HPP
+
+#include <QObject>
+
+class C : public QObject
+{
+ Q_OBJECT
+public:
+ C();
+};
+
+#endif
diff --git a/Tests/QtAutogen/staticLibraryCycle/main.cpp b/Tests/QtAutogen/staticLibraryCycle/main.cpp
new file mode 100644
index 000000000..f5b7fd227
--- /dev/null
+++ b/Tests/QtAutogen/staticLibraryCycle/main.cpp
@@ -0,0 +1,8 @@
+#include "a.h"
+
+int main(int argv, char** args)
+{
+ // Object instances
+ A a;
+ return 0;
+}