diff options
Diffstat (limited to 'Tests/QtAutogen/mocRerun')
-rw-r--r-- | Tests/QtAutogen/mocRerun/CMakeLists.txt | 34 | ||||
-rw-r--r-- | Tests/QtAutogen/mocRerun/input.txt | 1 | ||||
-rw-r--r-- | Tests/QtAutogen/mocRerun/main.cpp.in | 18 | ||||
-rw-r--r-- | Tests/QtAutogen/mocRerun/res1.qrc | 5 | ||||
-rw-r--r-- | Tests/QtAutogen/mocRerun/test1a.h.in | 8 | ||||
-rw-r--r-- | Tests/QtAutogen/mocRerun/test1b.h.in | 7 |
6 files changed, 73 insertions, 0 deletions
diff --git a/Tests/QtAutogen/mocRerun/CMakeLists.txt b/Tests/QtAutogen/mocRerun/CMakeLists.txt new file mode 100644 index 0000000..69ea8d7 --- /dev/null +++ b/Tests/QtAutogen/mocRerun/CMakeLists.txt @@ -0,0 +1,34 @@ +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 + ) +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 new file mode 100644 index 0000000..da62762 --- /dev/null +++ b/Tests/QtAutogen/mocRerun/input.txt @@ -0,0 +1 @@ +Res1 input. diff --git a/Tests/QtAutogen/mocRerun/main.cpp.in b/Tests/QtAutogen/mocRerun/main.cpp.in new file mode 100644 index 0000000..b37ff61 --- /dev/null +++ b/Tests/QtAutogen/mocRerun/main.cpp.in @@ -0,0 +1,18 @@ +#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 new file mode 100644 index 0000000..fb804b5 --- /dev/null +++ b/Tests/QtAutogen/mocRerun/res1.qrc @@ -0,0 +1,5 @@ +<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 new file mode 100644 index 0000000..a335046 --- /dev/null +++ b/Tests/QtAutogen/mocRerun/test1a.h.in @@ -0,0 +1,8 @@ +#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 new file mode 100644 index 0000000..6128eeb --- /dev/null +++ b/Tests/QtAutogen/mocRerun/test1b.h.in @@ -0,0 +1,7 @@ +#include <QObject> +class Test1 : public QObject +{ + Q_OBJECT +public slots: + void onTst1() {} +}; |