diff options
author | Sebastian Holtermann <sebholt@xwmw.org> | 2017-03-02 16:50:34 (GMT) |
---|---|---|
committer | Sebastian Holtermann <sebholt@xwmw.org> | 2017-03-06 21:01:03 (GMT) |
commit | 81656b92107b798d2e78929042812248d12853be (patch) | |
tree | ce8bc31899f010b0c1c95f4c114a5ae38faec54f /Tests/QtAutogen | |
parent | d9a7ef80aaff4373baf4c864c97efbbf20337dea (diff) | |
download | CMake-81656b92107b798d2e78929042812248d12853be.zip CMake-81656b92107b798d2e78929042812248d12853be.tar.gz CMake-81656b92107b798d2e78929042812248d12853be.tar.bz2 |
Autogen: Test: Add generated file to moc rerun test
Diffstat (limited to 'Tests/QtAutogen')
-rw-r--r-- | Tests/QtAutogen/mocRerun/CMakeLists.txt | 18 | ||||
-rw-r--r-- | Tests/QtAutogen/mocRerun/main.cpp.in | 18 | ||||
-rw-r--r-- | Tests/QtAutogen/mocRerun/test1.cpp | 5 | ||||
-rw-r--r-- | Tests/QtAutogen/mocRerun/test1a.h.in | 8 | ||||
-rw-r--r-- | Tests/QtAutogen/mocRerun/test1b.h.in | 6 |
5 files changed, 37 insertions, 18 deletions
diff --git a/Tests/QtAutogen/mocRerun/CMakeLists.txt b/Tests/QtAutogen/mocRerun/CMakeLists.txt index ca0eedf..6689f50 100644 --- a/Tests/QtAutogen/mocRerun/CMakeLists.txt +++ b/Tests/QtAutogen/mocRerun/CMakeLists.txt @@ -17,13 +17,19 @@ set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) configure_file(test1a.h.in test1.h COPYONLY) +# Generated source file +add_custom_command(OUTPUT main.cpp + COMMAND ${CMAKE_COMMAND} -E sleep 3 + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/main.cpp + ) -add_executable(test1 +add_executable(mocRerun ${CMAKE_CURRENT_BINARY_DIR}/test1.h - test1.cpp + ${CMAKE_CURRENT_BINARY_DIR}/main.cpp res1.qrc ) -target_include_directories(test1 PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) -target_link_libraries(test1 ${QT_CORE_TARGET}) -add_custom_command(TARGET test1 POST_BUILD COMMAND - ${CMAKE_COMMAND} -E echo "$<TARGET_FILE:test1>" > target1.txt) +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/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/test1.cpp b/Tests/QtAutogen/mocRerun/test1.cpp deleted file mode 100644 index 4316a91..0000000 --- a/Tests/QtAutogen/mocRerun/test1.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#include "test1.h" -int main() -{ - return 0; -} diff --git a/Tests/QtAutogen/mocRerun/test1a.h.in b/Tests/QtAutogen/mocRerun/test1a.h.in index fee2c09..a335046 100644 --- a/Tests/QtAutogen/mocRerun/test1a.h.in +++ b/Tests/QtAutogen/mocRerun/test1a.h.in @@ -1,8 +1,8 @@ #include <QObject> -class test1 : public QObject +class Test1 : public QObject { Q_OBJECT - public slots: - void onTst1() {} - void onTst2() {} +public slots: + void onTst1() {} + void onTst2() {} }; diff --git a/Tests/QtAutogen/mocRerun/test1b.h.in b/Tests/QtAutogen/mocRerun/test1b.h.in index 6531d10..6128eeb 100644 --- a/Tests/QtAutogen/mocRerun/test1b.h.in +++ b/Tests/QtAutogen/mocRerun/test1b.h.in @@ -1,7 +1,7 @@ #include <QObject> -class test1 : public QObject +class Test1 : public QObject { Q_OBJECT - public slots: - void onTst1() {} +public slots: + void onTst1() {} }; |