diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2020-12-23 13:35:51 (GMT) |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2021-01-06 19:16:36 (GMT) |
commit | 2999c40dd911a59b438bd5f400521ab5007d83d8 (patch) | |
tree | 193f3536f0c850a5aeead931360743046c0f98ee /Tests/QtAutogen | |
parent | f623664e877feae68bd4937adaf751d9a745893d (diff) | |
download | CMake-2999c40dd911a59b438bd5f400521ab5007d83d8.zip CMake-2999c40dd911a59b438bd5f400521ab5007d83d8.tar.gz CMake-2999c40dd911a59b438bd5f400521ab5007d83d8.tar.bz2 |
Extend QtAutogen/RerunMoc
Test that removing / adding a Q_OBJECT macro doesn't break incremental
builds.
This was initially done to test the fix for #21620, but the test passes
without the fix. The reason is that test1.h is included by main.cpp, which
contains a Q_OBJECT macro, meaning that test1.h is in AutoMoc's
dependencies transitively.
Diffstat (limited to 'Tests/QtAutogen')
-rw-r--r-- | Tests/QtAutogen/RerunMocBasic/CMakeLists.txt | 26 | ||||
-rw-r--r-- | Tests/QtAutogen/RerunMocBasic/MocBasic/test1c.h.in | 6 |
2 files changed, 32 insertions, 0 deletions
diff --git a/Tests/QtAutogen/RerunMocBasic/CMakeLists.txt b/Tests/QtAutogen/RerunMocBasic/CMakeLists.txt index a4179b7..72c99d5 100644 --- a/Tests/QtAutogen/RerunMocBasic/CMakeLists.txt +++ b/Tests/QtAutogen/RerunMocBasic/CMakeLists.txt @@ -118,3 +118,29 @@ message(STATUS "Changing nothing for no MOC re-run") rebuild(3) acquire_timestamp(After) require_change_not() + + +# - Ensure that the timestamp will change +# - Remove Q_OBJECT from header +# - Rebuild +acquire_timestamp(Before) +sleep() +message(STATUS "Remove Q_OBJECT from header file for a MOC re-run") +configure_file("${mocBasicSrcDir}/test1c.h.in" "${mocBasicBinDir}/test1.h" COPYONLY) +sleep() +rebuild(4) +acquire_timestamp(After) +require_change() + + +# - Ensure that the timestamp will change +# - Add Q_OBJECT to header again +# - Rebuild +acquire_timestamp(Before) +sleep() +message(STATUS "Add Q_OBJECT to header file for a MOC re-run") +configure_file("${mocBasicSrcDir}/test1a.h.in" "${mocBasicBinDir}/test1.h" COPYONLY) +sleep() +rebuild(5) +acquire_timestamp(After) +require_change() diff --git a/Tests/QtAutogen/RerunMocBasic/MocBasic/test1c.h.in b/Tests/QtAutogen/RerunMocBasic/MocBasic/test1c.h.in new file mode 100644 index 0000000..d0b9868 --- /dev/null +++ b/Tests/QtAutogen/RerunMocBasic/MocBasic/test1c.h.in @@ -0,0 +1,6 @@ +#include <QObject> +class Test1 +{ +public: + void onTst1() {} +}; |