diff options
author | Brad King <brad.king@kitware.com> | 2016-11-30 13:37:26 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2016-11-30 13:37:26 (GMT) |
commit | 8cdf566bc00da2b1a839a74bdbc99cfbc305bfee (patch) | |
tree | 6d1bd5b523b957ddce5ae2ab78d0df8326a3dd8d | |
parent | 32e95a7b24b057e410f0d49fa10a3d05452be264 (diff) | |
parent | 6938772a114099df406bc72cbc98a3c8d57cd458 (diff) | |
download | CMake-8cdf566bc00da2b1a839a74bdbc99cfbc305bfee.zip CMake-8cdf566bc00da2b1a839a74bdbc99cfbc305bfee.tar.gz CMake-8cdf566bc00da2b1a839a74bdbc99cfbc305bfee.tar.bz2 |
Merge topic 'QtAutogen_tests_update_v2'
6938772a QtAutogen tests: Pass Qt compiler features to library targets
c4d4becf QtAutogen tests: Move the complex test case to a subdirectory
2599f5d6 QtAutogen tests: Extend test description in CMakeLists.txt
7052af9d QtAutogen tests: Move independent sameName test to top list of CMakeLists.txt
d675004d QtAutogen tests: Rename uiconly target to camel case uicOnly
cb4bc19a QtAutogen tests: Rename rcc_empty target to camel case rccEmpty
59dbd3f8 QtAutogen tests: Rename rcconly target to camel case rccOnly.
-rw-r--r-- | Tests/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/QtAutogen/CMakeLists.txt | 132 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/Adir/CMakeLists.txt (renamed from Tests/QtAutogen/Adir/CMakeLists.txt) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/Adir/libA.cpp (renamed from Tests/QtAutogen/Adir/libA.cpp) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/Adir/libA.h (renamed from Tests/QtAutogen/Adir/libA.h) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/Bdir/CMakeLists.txt (renamed from Tests/QtAutogen/Bdir/CMakeLists.txt) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/Bdir/libB.cpp (renamed from Tests/QtAutogen/Bdir/libB.cpp) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/Bdir/libB.h (renamed from Tests/QtAutogen/Bdir/libB.h) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/CMakeLists.txt | 81 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/abc.cpp (renamed from Tests/QtAutogen/abc.cpp) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/abc.h (renamed from Tests/QtAutogen/abc.h) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/abc_p.h (renamed from Tests/QtAutogen/abc_p.h) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/bar.cpp (renamed from Tests/QtAutogen/bar.cpp) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/blub.cpp (renamed from Tests/QtAutogen/blub.cpp) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/blub.h (renamed from Tests/QtAutogen/blub.h) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/calwidget.cpp (renamed from Tests/QtAutogen/calwidget.cpp) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/calwidget.h (renamed from Tests/QtAutogen/calwidget.h) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/calwidget.ui (renamed from Tests/QtAutogen/calwidget.ui) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/codeeditor.cpp (renamed from Tests/QtAutogen/codeeditor.cpp) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/codeeditor.h (renamed from Tests/QtAutogen/codeeditor.h) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/debug_class.cpp (renamed from Tests/QtAutogen/debug_class.cpp) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/debug_class.h (renamed from Tests/QtAutogen/debug_class.h) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/debug_class.ui (renamed from Tests/QtAutogen/debug_class.ui) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/debug_resource.qrc (renamed from Tests/QtAutogen/debug_resource.qrc) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/foo.cpp (renamed from Tests/QtAutogen/foo.cpp) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/foo.h (renamed from Tests/QtAutogen/foo.h) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/gadget.cpp (renamed from Tests/QtAutogen/gadget.cpp) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/gadget.h (renamed from Tests/QtAutogen/gadget.h) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/generated.cpp (renamed from Tests/QtAutogen/generated.cpp) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/generated.h (renamed from Tests/QtAutogen/generated.h) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/generated.txt.in (renamed from Tests/QtAutogen/generated.txt.in) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/generated_resource.qrc.in (renamed from Tests/QtAutogen/generated_resource.qrc.in) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/libC.cpp (renamed from Tests/QtAutogen/libC.cpp) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/libC.h (renamed from Tests/QtAutogen/libC.h) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/main.cpp (renamed from Tests/QtAutogen/main.cpp) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/multiplewidgets.cpp (renamed from Tests/QtAutogen/multiplewidgets.cpp) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/multiplewidgets.h (renamed from Tests/QtAutogen/multiplewidgets.h) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/myinterface.h.in (renamed from Tests/QtAutogen/myinterface.h.in) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/myotherinterface.h.in (renamed from Tests/QtAutogen/myotherinterface.h.in) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/private_slot.cpp (renamed from Tests/QtAutogen/private_slot.cpp) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/private_slot.h (renamed from Tests/QtAutogen/private_slot.h) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/resourcetester.cpp (renamed from Tests/QtAutogen/resourcetester.cpp) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/resourcetester.h (renamed from Tests/QtAutogen/resourcetester.h) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/second_resource.qrc (renamed from Tests/QtAutogen/second_resource.qrc) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/second_widget.cpp (renamed from Tests/QtAutogen/second_widget.cpp) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/second_widget.h (renamed from Tests/QtAutogen/second_widget.h) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/second_widget.ui (renamed from Tests/QtAutogen/second_widget.ui) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/sub/bar.h (renamed from Tests/QtAutogen/sub/bar.h) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/targetObjectsTest.cpp (renamed from Tests/QtAutogen/targetObjectsTest.cpp) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/test.qrc (renamed from Tests/QtAutogen/test.qrc) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/widget1.ui (renamed from Tests/QtAutogen/widget1.ui) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/widget2.ui (renamed from Tests/QtAutogen/widget2.ui) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/xyz.cpp (renamed from Tests/QtAutogen/xyz.cpp) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/xyz.h (renamed from Tests/QtAutogen/xyz.h) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/yaf.cpp (renamed from Tests/QtAutogen/yaf.cpp) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/yaf.h (renamed from Tests/QtAutogen/yaf.h) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/complex/yaf_p.h (renamed from Tests/QtAutogen/yaf_p.h) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/rccEmpty.cpp (renamed from Tests/QtAutogen/rcconly.cpp) | 4 | ||||
-rw-r--r-- | Tests/QtAutogen/rccEmptyRes.qrc (renamed from Tests/QtAutogen/rcc_empty_resource.qrc) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/rccOnly.cpp (renamed from Tests/QtAutogen/rcc_empty.cpp) | 4 | ||||
-rw-r--r-- | Tests/QtAutogen/rccOnlyRes.qrc | 5 | ||||
-rw-r--r-- | Tests/QtAutogen/uicOnlySource/uiconly.cpp (renamed from Tests/QtAutogen/sub/uiconly.cpp) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/uicOnlySource/uiconly.h (renamed from Tests/QtAutogen/sub/uiconly.h) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/uicOnlySource/uiconly.ui (renamed from Tests/QtAutogen/sub/uiconly.ui) | 0 |
64 files changed, 127 insertions, 101 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 8b59e8f..fa5f3e8 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1245,7 +1245,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release set(run_autogen_test ${CMAKE_CTEST_COMMAND} -V) set(run_autouic_test ${CMAKE_CTEST_COMMAND} -V) else() - set(run_autogen_test QtAutogen) + set(run_autogen_test complex/QtAutogen) set(run_autouic_test QtAutoUicInterface) endif() if(NOT CMAKE_CONFIGURATION_TYPES) diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index c713d1c..c4d0567 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -44,114 +44,45 @@ else() endif() -# -- RCC only -add_executable(rcconly rcconly.cpp second_resource.qrc) -set_property(TARGET rcconly PROPERTY AUTORCC ON) -target_link_libraries(rcconly ${QT_QTCORE_TARGET}) - -# -- RCC empty -add_executable(rcc_empty rcc_empty.cpp rcc_empty_resource.qrc) -set_property(TARGET rcc_empty PROPERTY AUTORCC ON) -target_link_libraries(rcc_empty ${QT_QTCORE_TARGET}) - +get_property(QT_COMPILE_FEATURES TARGET ${QT_QTCORE_TARGET} PROPERTY INTERFACE_COMPILE_FEATURES) include_directories(${CMAKE_CURRENT_BINARY_DIR}) -add_definitions(-DFOO -DSomeDefine="Barx") - -# enable relaxed mode so automoc can handle all the special cases: -set(CMAKE_AUTOMOC_RELAXED_MODE TRUE) - -set(CMAKE_AUTOUIC ON) -set(CMAKE_AUTORCC ON) - -# create an executable and two library targets, each requiring automoc: -add_library(codeeditorLib STATIC codeeditor.cpp) - -add_library(privateSlot OBJECT private_slot.cpp) - -configure_file(generated_resource.qrc.in generated_resource.qrc @ONLY) -add_custom_command( - OUTPUT generated.txt - COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/generated.txt.in" "${CMAKE_CURRENT_BINARY_DIR}/generated.txt" - DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/generated.txt.in" - ) - -add_custom_target(generate_moc_input - DEPENDS generated.txt - COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/myinterface.h.in" "${CMAKE_CURRENT_BINARY_DIR}" - COMMAND ${CMAKE_COMMAND} -E rename "${CMAKE_CURRENT_BINARY_DIR}/myinterface.h.in" "${CMAKE_CURRENT_BINARY_DIR}/myinterface.h" -) - -add_custom_command( - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/myotherinterface.h" - COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/myotherinterface.h.in" "${CMAKE_CURRENT_BINARY_DIR}/myotherinterface.h" - DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/myotherinterface.h.in" -) - -if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_GENERATOR STREQUAL Ninja) - set(debug_srcs "$<$<CONFIG:Debug>:debug_class.cpp>" $<$<CONFIG:Debug>:debug_resource.qrc>) - set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:Debug>:TEST_DEBUG_CLASS>) -endif() - -# The -no-protection option disables the generation of include guards. Verify -# that setting the source file property has an effect by using this and -# issue an error in the preprocessor in calwidget.cpp if the include guard -# is defined. -set_source_files_properties(calwidget.ui PROPERTIES AUTOUIC_OPTIONS "-no-protection") - -add_executable(QtAutogen main.cpp calwidget.cpp second_widget.cpp foo.cpp blub.cpp bar.cpp abc.cpp - multiplewidgets.cpp - xyz.cpp yaf.cpp gadget.cpp $<TARGET_OBJECTS:privateSlot> - test.qrc second_resource.qrc resourcetester.cpp generated.cpp ${debug_srcs} - ${CMAKE_CURRENT_BINARY_DIR}/generated_resource.qrc -) -set_property(TARGET QtAutogen APPEND PROPERTY AUTOGEN_TARGET_DEPENDS generate_moc_input "${CMAKE_CURRENT_BINARY_DIR}/myotherinterface.h") - -add_executable(targetObjectsTest targetObjectsTest.cpp $<TARGET_OBJECTS:privateSlot>) -target_link_libraries(targetObjectsTest ${QT_LIBRARIES}) - -set_target_properties( - QtAutogen codeeditorLib privateSlot targetObjectsTest - PROPERTIES - AUTOMOC TRUE -) - -# Test AUTOMOC and AUTORCC on source files with the same name -# but in different subdirectories -add_subdirectory(sameName) - -include(GenerateExportHeader) -# The order is relevant here. B depends on A, and B headers depend on A -# headers both subdirectories use CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE and we -# test that CMAKE_AUTOMOC successfully reads the include directories -# for the build interface from those targets. There has previously been -# a bug where caching of the include directories happened before -# extracting the includes to pass to moc. -add_subdirectory(Bdir) -add_subdirectory(Adir) -add_library(libC SHARED libC.cpp) -set_target_properties(libC PROPERTIES AUTOMOC TRUE) -generate_export_header(libC) -target_link_libraries(libC LINK_PUBLIC libB) - -target_link_libraries(QtAutogen codeeditorLib ${QT_LIBRARIES} libC) - +# -- Test: AUTORCC +# RCC only +add_executable(rccOnly rccOnly.cpp rccOnlyRes.qrc) +set_property(TARGET rccOnly PROPERTY AUTORCC ON) +target_link_libraries(rccOnly ${QT_QTCORE_TARGET}) + +# -- Test: AUTORCC +# RCC empty +add_executable(rccEmpty rccEmpty.cpp rccEmptyRes.qrc) +set_property(TARGET rccEmpty PROPERTY AUTORCC ON) +target_link_libraries(rccEmpty ${QT_QTCORE_TARGET}) + +# -- Test: AUTOUIC +# 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: AUTOMOC, AUTORCC # 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 # have an effect on generation if AUTORCC is off. add_library(empty STATIC empty.cpp not_generated_file.qrc) set_target_properties(empty PROPERTIES AUTORCC OFF) - set_target_properties(empty PROPERTIES AUTOMOC TRUE) target_link_libraries(empty no_link_language) add_library(no_link_language STATIC empty.h) set_target_properties(no_link_language PROPERTIES AUTOMOC TRUE) +# Pass Qt compiler features to targets that don't link against Qt +target_compile_features(no_link_language PRIVATE ${QT_COMPILE_FEATURES}) +target_compile_features(empty PRIVATE ${QT_COMPILE_FEATURES}) -qtx_wrap_cpp(uicOnlyMoc sub/uiconly.h) -add_executable(uiconly sub/uiconly.cpp ${uicOnlyMoc}) -target_link_libraries(uiconly ${QT_LIBRARIES}) - +# -- Test: AUTORCC +# When a file listed in a .qrc file changes the target must be rebuilt try_compile(RCC_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/autorcc_depends" "${CMAKE_CURRENT_SOURCE_DIR}/autorcc_depends" @@ -185,7 +116,8 @@ if (NOT file1_step1 GREATER file1_before) message(SEND_ERROR "file1 (${qrc_file1}) should have changed in the first step!") endif() -#----------------------------------------------------------------------------- +# -- Test: AUTOMOC +# Ensure a repeated build succeeds when a header containing a QObject changes try_compile(MOC_RERUN "${CMAKE_CURRENT_BINARY_DIR}/automoc_rerun" "${CMAKE_CURRENT_SOURCE_DIR}/automoc_rerun" @@ -207,3 +139,11 @@ execute_process(COMMAND "${CMAKE_COMMAND}" --build . if (automoc_rerun_result) message(SEND_ERROR "Second build of automoc_rerun failed.") endif() + +# -- Test: AUTOMOC AUTORCC +# Source files with the same basename in different subdirectories +add_subdirectory(sameName) + +# -- Test: AUTOMOC AUTORCC AUTOUIC +# Complex test case +add_subdirectory(complex) diff --git a/Tests/QtAutogen/Adir/CMakeLists.txt b/Tests/QtAutogen/complex/Adir/CMakeLists.txt index a1c36ff..a1c36ff 100644 --- a/Tests/QtAutogen/Adir/CMakeLists.txt +++ b/Tests/QtAutogen/complex/Adir/CMakeLists.txt diff --git a/Tests/QtAutogen/Adir/libA.cpp b/Tests/QtAutogen/complex/Adir/libA.cpp index f79f24a..f79f24a 100644 --- a/Tests/QtAutogen/Adir/libA.cpp +++ b/Tests/QtAutogen/complex/Adir/libA.cpp diff --git a/Tests/QtAutogen/Adir/libA.h b/Tests/QtAutogen/complex/Adir/libA.h index c4eb9f7..c4eb9f7 100644 --- a/Tests/QtAutogen/Adir/libA.h +++ b/Tests/QtAutogen/complex/Adir/libA.h diff --git a/Tests/QtAutogen/Bdir/CMakeLists.txt b/Tests/QtAutogen/complex/Bdir/CMakeLists.txt index d9d4aa7..d9d4aa7 100644 --- a/Tests/QtAutogen/Bdir/CMakeLists.txt +++ b/Tests/QtAutogen/complex/Bdir/CMakeLists.txt diff --git a/Tests/QtAutogen/Bdir/libB.cpp b/Tests/QtAutogen/complex/Bdir/libB.cpp index d3b6753..d3b6753 100644 --- a/Tests/QtAutogen/Bdir/libB.cpp +++ b/Tests/QtAutogen/complex/Bdir/libB.cpp diff --git a/Tests/QtAutogen/Bdir/libB.h b/Tests/QtAutogen/complex/Bdir/libB.h index e4ab788..e4ab788 100644 --- a/Tests/QtAutogen/Bdir/libB.h +++ b/Tests/QtAutogen/complex/Bdir/libB.h diff --git a/Tests/QtAutogen/complex/CMakeLists.txt b/Tests/QtAutogen/complex/CMakeLists.txt new file mode 100644 index 0000000..0d44f50 --- /dev/null +++ b/Tests/QtAutogen/complex/CMakeLists.txt @@ -0,0 +1,81 @@ +cmake_minimum_required(VERSION 3.1) + +# -- Test: AUTOMOC AUTORCC AUTOUIC +include_directories(${CMAKE_CURRENT_BINARY_DIR}) +add_definitions(-DFOO -DSomeDefine="Barx") + +# enable relaxed mode so automoc can handle all the special cases: +set(CMAKE_AUTOMOC_RELAXED_MODE TRUE) +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTORCC ON) + +# create an executable and two library targets, each requiring automoc: +add_library(codeeditorLib STATIC codeeditor.cpp) +add_library(privateSlot OBJECT private_slot.cpp) +# Pass Qt compiler features to targets that don't link against Qt +target_compile_features(codeeditorLib PRIVATE ${QT_COMPILE_FEATURES}) +target_compile_features(privateSlot PRIVATE ${QT_COMPILE_FEATURES}) + +configure_file(generated_resource.qrc.in generated_resource.qrc @ONLY) +add_custom_command( + OUTPUT generated.txt + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/generated.txt.in" "${CMAKE_CURRENT_BINARY_DIR}/generated.txt" + DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/generated.txt.in" + ) + +add_custom_target(generate_moc_input + DEPENDS generated.txt + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/myinterface.h.in" "${CMAKE_CURRENT_BINARY_DIR}" + COMMAND ${CMAKE_COMMAND} -E rename "${CMAKE_CURRENT_BINARY_DIR}/myinterface.h.in" "${CMAKE_CURRENT_BINARY_DIR}/myinterface.h" +) + +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/myotherinterface.h" + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/myotherinterface.h.in" "${CMAKE_CURRENT_BINARY_DIR}/myotherinterface.h" + DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/myotherinterface.h.in" +) + +if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_GENERATOR STREQUAL Ninja) + set(debug_srcs "$<$<CONFIG:Debug>:debug_class.cpp>" $<$<CONFIG:Debug>:debug_resource.qrc>) + set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:Debug>:TEST_DEBUG_CLASS>) +endif() + +# The -no-protection option disables the generation of include guards. Verify +# that setting the source file property has an effect by using this and +# issue an error in the preprocessor in calwidget.cpp if the include guard +# is defined. +set_source_files_properties(calwidget.ui PROPERTIES AUTOUIC_OPTIONS "-no-protection") + +add_executable(QtAutogen main.cpp calwidget.cpp second_widget.cpp foo.cpp blub.cpp bar.cpp abc.cpp + multiplewidgets.cpp + xyz.cpp yaf.cpp gadget.cpp $<TARGET_OBJECTS:privateSlot> + test.qrc second_resource.qrc resourcetester.cpp generated.cpp ${debug_srcs} + ${CMAKE_CURRENT_BINARY_DIR}/generated_resource.qrc +) +set_property(TARGET QtAutogen APPEND PROPERTY AUTOGEN_TARGET_DEPENDS generate_moc_input "${CMAKE_CURRENT_BINARY_DIR}/myotherinterface.h") + +add_executable(targetObjectsTest targetObjectsTest.cpp $<TARGET_OBJECTS:privateSlot>) +target_link_libraries(targetObjectsTest ${QT_LIBRARIES}) + +set_target_properties( + QtAutogen codeeditorLib privateSlot targetObjectsTest + PROPERTIES + AUTOMOC TRUE +) + + +include(GenerateExportHeader) +# The order is relevant here. B depends on A, and B headers depend on A +# headers both subdirectories use CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE and we +# test that CMAKE_AUTOMOC successfully reads the include directories +# for the build interface from those targets. There has previously been +# a bug where caching of the include directories happened before +# extracting the includes to pass to moc. +add_subdirectory(Bdir) +add_subdirectory(Adir) +add_library(libC SHARED libC.cpp) +set_target_properties(libC PROPERTIES AUTOMOC TRUE) +generate_export_header(libC) +target_link_libraries(libC LINK_PUBLIC libB) + +target_link_libraries(QtAutogen codeeditorLib ${QT_LIBRARIES} libC) diff --git a/Tests/QtAutogen/abc.cpp b/Tests/QtAutogen/complex/abc.cpp index 2929b92..2929b92 100644 --- a/Tests/QtAutogen/abc.cpp +++ b/Tests/QtAutogen/complex/abc.cpp diff --git a/Tests/QtAutogen/abc.h b/Tests/QtAutogen/complex/abc.h index ec5f411..ec5f411 100644 --- a/Tests/QtAutogen/abc.h +++ b/Tests/QtAutogen/complex/abc.h diff --git a/Tests/QtAutogen/abc_p.h b/Tests/QtAutogen/complex/abc_p.h index be98487..be98487 100644 --- a/Tests/QtAutogen/abc_p.h +++ b/Tests/QtAutogen/complex/abc_p.h diff --git a/Tests/QtAutogen/bar.cpp b/Tests/QtAutogen/complex/bar.cpp index 734bd7a..734bd7a 100644 --- a/Tests/QtAutogen/bar.cpp +++ b/Tests/QtAutogen/complex/bar.cpp diff --git a/Tests/QtAutogen/blub.cpp b/Tests/QtAutogen/complex/blub.cpp index 1c497e0..1c497e0 100644 --- a/Tests/QtAutogen/blub.cpp +++ b/Tests/QtAutogen/complex/blub.cpp diff --git a/Tests/QtAutogen/blub.h b/Tests/QtAutogen/complex/blub.h index ff79878..ff79878 100644 --- a/Tests/QtAutogen/blub.h +++ b/Tests/QtAutogen/complex/blub.h diff --git a/Tests/QtAutogen/calwidget.cpp b/Tests/QtAutogen/complex/calwidget.cpp index 380e982..380e982 100644 --- a/Tests/QtAutogen/calwidget.cpp +++ b/Tests/QtAutogen/complex/calwidget.cpp diff --git a/Tests/QtAutogen/calwidget.h b/Tests/QtAutogen/complex/calwidget.h index 084d959..084d959 100644 --- a/Tests/QtAutogen/calwidget.h +++ b/Tests/QtAutogen/complex/calwidget.h diff --git a/Tests/QtAutogen/calwidget.ui b/Tests/QtAutogen/complex/calwidget.ui index 1c245ca..1c245ca 100644 --- a/Tests/QtAutogen/calwidget.ui +++ b/Tests/QtAutogen/complex/calwidget.ui diff --git a/Tests/QtAutogen/codeeditor.cpp b/Tests/QtAutogen/complex/codeeditor.cpp index 0caf8a7..0caf8a7 100644 --- a/Tests/QtAutogen/codeeditor.cpp +++ b/Tests/QtAutogen/complex/codeeditor.cpp diff --git a/Tests/QtAutogen/codeeditor.h b/Tests/QtAutogen/complex/codeeditor.h index b410bd4..b410bd4 100644 --- a/Tests/QtAutogen/codeeditor.h +++ b/Tests/QtAutogen/complex/codeeditor.h diff --git a/Tests/QtAutogen/debug_class.cpp b/Tests/QtAutogen/complex/debug_class.cpp index 46b09e7..46b09e7 100644 --- a/Tests/QtAutogen/debug_class.cpp +++ b/Tests/QtAutogen/complex/debug_class.cpp diff --git a/Tests/QtAutogen/debug_class.h b/Tests/QtAutogen/complex/debug_class.h index c02f0ed..c02f0ed 100644 --- a/Tests/QtAutogen/debug_class.h +++ b/Tests/QtAutogen/complex/debug_class.h diff --git a/Tests/QtAutogen/debug_class.ui b/Tests/QtAutogen/complex/debug_class.ui index dc2e1ac..dc2e1ac 100644 --- a/Tests/QtAutogen/debug_class.ui +++ b/Tests/QtAutogen/complex/debug_class.ui diff --git a/Tests/QtAutogen/debug_resource.qrc b/Tests/QtAutogen/complex/debug_resource.qrc index db98b9b..db98b9b 100644 --- a/Tests/QtAutogen/debug_resource.qrc +++ b/Tests/QtAutogen/complex/debug_resource.qrc diff --git a/Tests/QtAutogen/foo.cpp b/Tests/QtAutogen/complex/foo.cpp index f665eee..f665eee 100644 --- a/Tests/QtAutogen/foo.cpp +++ b/Tests/QtAutogen/complex/foo.cpp diff --git a/Tests/QtAutogen/foo.h b/Tests/QtAutogen/complex/foo.h index 3e03fe6..3e03fe6 100644 --- a/Tests/QtAutogen/foo.h +++ b/Tests/QtAutogen/complex/foo.h diff --git a/Tests/QtAutogen/gadget.cpp b/Tests/QtAutogen/complex/gadget.cpp index 23d95fa..23d95fa 100644 --- a/Tests/QtAutogen/gadget.cpp +++ b/Tests/QtAutogen/complex/gadget.cpp diff --git a/Tests/QtAutogen/gadget.h b/Tests/QtAutogen/complex/gadget.h index 3253e31..3253e31 100644 --- a/Tests/QtAutogen/gadget.h +++ b/Tests/QtAutogen/complex/gadget.h diff --git a/Tests/QtAutogen/generated.cpp b/Tests/QtAutogen/complex/generated.cpp index d514c61..d514c61 100644 --- a/Tests/QtAutogen/generated.cpp +++ b/Tests/QtAutogen/complex/generated.cpp diff --git a/Tests/QtAutogen/generated.h b/Tests/QtAutogen/complex/generated.h index 62e1607..62e1607 100644 --- a/Tests/QtAutogen/generated.h +++ b/Tests/QtAutogen/complex/generated.h diff --git a/Tests/QtAutogen/generated.txt.in b/Tests/QtAutogen/complex/generated.txt.in index 77507bb..77507bb 100644 --- a/Tests/QtAutogen/generated.txt.in +++ b/Tests/QtAutogen/complex/generated.txt.in diff --git a/Tests/QtAutogen/generated_resource.qrc.in b/Tests/QtAutogen/complex/generated_resource.qrc.in index da5fa62..da5fa62 100644 --- a/Tests/QtAutogen/generated_resource.qrc.in +++ b/Tests/QtAutogen/complex/generated_resource.qrc.in diff --git a/Tests/QtAutogen/libC.cpp b/Tests/QtAutogen/complex/libC.cpp index a3acff1..a3acff1 100644 --- a/Tests/QtAutogen/libC.cpp +++ b/Tests/QtAutogen/complex/libC.cpp diff --git a/Tests/QtAutogen/libC.h b/Tests/QtAutogen/complex/libC.h index 3bc2bad..3bc2bad 100644 --- a/Tests/QtAutogen/libC.h +++ b/Tests/QtAutogen/complex/libC.h diff --git a/Tests/QtAutogen/main.cpp b/Tests/QtAutogen/complex/main.cpp index d557c70..d557c70 100644 --- a/Tests/QtAutogen/main.cpp +++ b/Tests/QtAutogen/complex/main.cpp diff --git a/Tests/QtAutogen/multiplewidgets.cpp b/Tests/QtAutogen/complex/multiplewidgets.cpp index fda36ea..fda36ea 100644 --- a/Tests/QtAutogen/multiplewidgets.cpp +++ b/Tests/QtAutogen/complex/multiplewidgets.cpp diff --git a/Tests/QtAutogen/multiplewidgets.h b/Tests/QtAutogen/complex/multiplewidgets.h index a4d0a50..a4d0a50 100644 --- a/Tests/QtAutogen/multiplewidgets.h +++ b/Tests/QtAutogen/complex/multiplewidgets.h diff --git a/Tests/QtAutogen/myinterface.h.in b/Tests/QtAutogen/complex/myinterface.h.in index c6c0ba1..c6c0ba1 100644 --- a/Tests/QtAutogen/myinterface.h.in +++ b/Tests/QtAutogen/complex/myinterface.h.in diff --git a/Tests/QtAutogen/myotherinterface.h.in b/Tests/QtAutogen/complex/myotherinterface.h.in index d21e7af..d21e7af 100644 --- a/Tests/QtAutogen/myotherinterface.h.in +++ b/Tests/QtAutogen/complex/myotherinterface.h.in diff --git a/Tests/QtAutogen/private_slot.cpp b/Tests/QtAutogen/complex/private_slot.cpp index ab1682a..ab1682a 100644 --- a/Tests/QtAutogen/private_slot.cpp +++ b/Tests/QtAutogen/complex/private_slot.cpp diff --git a/Tests/QtAutogen/private_slot.h b/Tests/QtAutogen/complex/private_slot.h index 8041eb2..8041eb2 100644 --- a/Tests/QtAutogen/private_slot.h +++ b/Tests/QtAutogen/complex/private_slot.h diff --git a/Tests/QtAutogen/resourcetester.cpp b/Tests/QtAutogen/complex/resourcetester.cpp index 4ecb6b4..4ecb6b4 100644 --- a/Tests/QtAutogen/resourcetester.cpp +++ b/Tests/QtAutogen/complex/resourcetester.cpp diff --git a/Tests/QtAutogen/resourcetester.h b/Tests/QtAutogen/complex/resourcetester.h index dbdb3ad..dbdb3ad 100644 --- a/Tests/QtAutogen/resourcetester.h +++ b/Tests/QtAutogen/complex/resourcetester.h diff --git a/Tests/QtAutogen/second_resource.qrc b/Tests/QtAutogen/complex/second_resource.qrc index 27bfb14..27bfb14 100644 --- a/Tests/QtAutogen/second_resource.qrc +++ b/Tests/QtAutogen/complex/second_resource.qrc diff --git a/Tests/QtAutogen/second_widget.cpp b/Tests/QtAutogen/complex/second_widget.cpp index c575f10..c575f10 100644 --- a/Tests/QtAutogen/second_widget.cpp +++ b/Tests/QtAutogen/complex/second_widget.cpp diff --git a/Tests/QtAutogen/second_widget.h b/Tests/QtAutogen/complex/second_widget.h index c7929c4..c7929c4 100644 --- a/Tests/QtAutogen/second_widget.h +++ b/Tests/QtAutogen/complex/second_widget.h diff --git a/Tests/QtAutogen/second_widget.ui b/Tests/QtAutogen/complex/second_widget.ui index 4effa58..4effa58 100644 --- a/Tests/QtAutogen/second_widget.ui +++ b/Tests/QtAutogen/complex/second_widget.ui diff --git a/Tests/QtAutogen/sub/bar.h b/Tests/QtAutogen/complex/sub/bar.h index e4093f6..e4093f6 100644 --- a/Tests/QtAutogen/sub/bar.h +++ b/Tests/QtAutogen/complex/sub/bar.h diff --git a/Tests/QtAutogen/targetObjectsTest.cpp b/Tests/QtAutogen/complex/targetObjectsTest.cpp index 766b775..766b775 100644 --- a/Tests/QtAutogen/targetObjectsTest.cpp +++ b/Tests/QtAutogen/complex/targetObjectsTest.cpp diff --git a/Tests/QtAutogen/test.qrc b/Tests/QtAutogen/complex/test.qrc index c3d4e3c..c3d4e3c 100644 --- a/Tests/QtAutogen/test.qrc +++ b/Tests/QtAutogen/complex/test.qrc diff --git a/Tests/QtAutogen/widget1.ui b/Tests/QtAutogen/complex/widget1.ui index 8fce81a..8fce81a 100644 --- a/Tests/QtAutogen/widget1.ui +++ b/Tests/QtAutogen/complex/widget1.ui diff --git a/Tests/QtAutogen/widget2.ui b/Tests/QtAutogen/complex/widget2.ui index 1f411b9..1f411b9 100644 --- a/Tests/QtAutogen/widget2.ui +++ b/Tests/QtAutogen/complex/widget2.ui diff --git a/Tests/QtAutogen/xyz.cpp b/Tests/QtAutogen/complex/xyz.cpp index e46c9d3..e46c9d3 100644 --- a/Tests/QtAutogen/xyz.cpp +++ b/Tests/QtAutogen/complex/xyz.cpp diff --git a/Tests/QtAutogen/xyz.h b/Tests/QtAutogen/complex/xyz.h index 8b813fd..8b813fd 100644 --- a/Tests/QtAutogen/xyz.h +++ b/Tests/QtAutogen/complex/xyz.h diff --git a/Tests/QtAutogen/yaf.cpp b/Tests/QtAutogen/complex/yaf.cpp index 70e26aa..70e26aa 100644 --- a/Tests/QtAutogen/yaf.cpp +++ b/Tests/QtAutogen/complex/yaf.cpp diff --git a/Tests/QtAutogen/yaf.h b/Tests/QtAutogen/complex/yaf.h index f271061..f271061 100644 --- a/Tests/QtAutogen/yaf.h +++ b/Tests/QtAutogen/complex/yaf.h diff --git a/Tests/QtAutogen/yaf_p.h b/Tests/QtAutogen/complex/yaf_p.h index ea5eed6..ea5eed6 100644 --- a/Tests/QtAutogen/yaf_p.h +++ b/Tests/QtAutogen/complex/yaf_p.h diff --git a/Tests/QtAutogen/rcconly.cpp b/Tests/QtAutogen/rccEmpty.cpp index 854c4c1..7f2c527 100644 --- a/Tests/QtAutogen/rcconly.cpp +++ b/Tests/QtAutogen/rccEmpty.cpp @@ -1,9 +1,9 @@ -extern int qInitResources_second_resource(); +extern int qInitResources_rccEmptyRes(); int main(int, char**) { // Fails to link if the symbol is not present. - qInitResources_second_resource(); + qInitResources_rccEmptyRes(); return 0; } diff --git a/Tests/QtAutogen/rcc_empty_resource.qrc b/Tests/QtAutogen/rccEmptyRes.qrc index 4ca9cd5..4ca9cd5 100644 --- a/Tests/QtAutogen/rcc_empty_resource.qrc +++ b/Tests/QtAutogen/rccEmptyRes.qrc diff --git a/Tests/QtAutogen/rcc_empty.cpp b/Tests/QtAutogen/rccOnly.cpp index 3f9f9a2..61c7bf4 100644 --- a/Tests/QtAutogen/rcc_empty.cpp +++ b/Tests/QtAutogen/rccOnly.cpp @@ -1,9 +1,9 @@ -extern int qInitResources_rcc_empty_resource(); +extern int qInitResources_rccOnlyRes(); int main(int, char**) { // Fails to link if the symbol is not present. - qInitResources_rcc_empty_resource(); + qInitResources_rccOnlyRes(); return 0; } diff --git a/Tests/QtAutogen/rccOnlyRes.qrc b/Tests/QtAutogen/rccOnlyRes.qrc new file mode 100644 index 0000000..5551348 --- /dev/null +++ b/Tests/QtAutogen/rccOnlyRes.qrc @@ -0,0 +1,5 @@ +<!DOCTYPE RCC><RCC version="1.0"> +<qresource> + <file>rccOnly.cpp</file> +</qresource> +</RCC> diff --git a/Tests/QtAutogen/sub/uiconly.cpp b/Tests/QtAutogen/uicOnlySource/uiconly.cpp index ac22789..ac22789 100644 --- a/Tests/QtAutogen/sub/uiconly.cpp +++ b/Tests/QtAutogen/uicOnlySource/uiconly.cpp diff --git a/Tests/QtAutogen/sub/uiconly.h b/Tests/QtAutogen/uicOnlySource/uiconly.h index 9b0b1b4..9b0b1b4 100644 --- a/Tests/QtAutogen/sub/uiconly.h +++ b/Tests/QtAutogen/uicOnlySource/uiconly.h diff --git a/Tests/QtAutogen/sub/uiconly.ui b/Tests/QtAutogen/uicOnlySource/uiconly.ui index 13fb832..13fb832 100644 --- a/Tests/QtAutogen/sub/uiconly.ui +++ b/Tests/QtAutogen/uicOnlySource/uiconly.ui |