diff options
Diffstat (limited to 'Tests/QtAutogenRerun')
-rw-r--r-- | Tests/QtAutogenRerun/CMakeLists.txt | 5 | ||||
-rw-r--r-- | Tests/QtAutogenRerun/mocRerun.cmake | 60 | ||||
-rw-r--r-- | Tests/QtAutogenRerun/mocRerun/CMakeLists.txt | 33 | ||||
-rw-r--r-- | Tests/QtAutogenRerun/mocRerun/input.txt | 1 | ||||
-rw-r--r-- | Tests/QtAutogenRerun/mocRerun/main.cpp.in | 18 | ||||
-rw-r--r-- | Tests/QtAutogenRerun/mocRerun/res1.qrc | 5 | ||||
-rw-r--r-- | Tests/QtAutogenRerun/mocRerun/test1a.h.in | 8 | ||||
-rw-r--r-- | Tests/QtAutogenRerun/mocRerun/test1b.h.in | 7 |
8 files changed, 1 insertions, 136 deletions
diff --git a/Tests/QtAutogenRerun/CMakeLists.txt b/Tests/QtAutogenRerun/CMakeLists.txt index e72c191..746ba4a 100644 --- a/Tests/QtAutogenRerun/CMakeLists.txt +++ b/Tests/QtAutogenRerun/CMakeLists.txt @@ -6,7 +6,7 @@ project(QtAutogenRerun) 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}) + list(APPEND CMAKE_PREFIX_PATH ${Qt_PREFIX_DIR}) endif() if (QT_TEST_VERSION STREQUAL 4) @@ -40,9 +40,6 @@ endif() add_executable(dummy dummy.cpp) # -- Test -include("mocRerun.cmake") - -# -- Test # Tests Q_PLUGIN_METADATA json file change detection if (NOT QT_TEST_VERSION STREQUAL 4) include("mocPlugin.cmake") diff --git a/Tests/QtAutogenRerun/mocRerun.cmake b/Tests/QtAutogenRerun/mocRerun.cmake deleted file mode 100644 index a92912b..0000000 --- a/Tests/QtAutogenRerun/mocRerun.cmake +++ /dev/null @@ -1,60 +0,0 @@ - -set(timeformat "%Y%j%H%M%S") -set(mocRerunSrcDir "${CMAKE_CURRENT_SOURCE_DIR}/mocRerun") -set(mocRerunBinDir "${CMAKE_CURRENT_BINARY_DIR}/mocRerun") - -# Initial build -configure_file("${mocRerunSrcDir}/test1a.h.in" "${mocRerunBinDir}/test1.h" COPYONLY) -try_compile(MOC_RERUN - "${mocRerunBinDir}" - "${mocRerunSrcDir}" - 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 of the output binary -file(STRINGS "${mocRerunBinDir}/mocRerun.txt" mocRerunList ENCODING UTF-8) -list(GET mocRerunList 0 mocRerunBin) - -message("Changing the header content for a MOC rerun") -# - Acquire binary timestamps before the build -file(TIMESTAMP "${mocRerunBin}" timeBefore "${timeformat}") -# - Ensure that the timestamp will change -# - Change header file content and rebuild -# - Rebuild -execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) -configure_file("${mocRerunSrcDir}/test1b.h.in" "${mocRerunBinDir}/test1.h" COPYONLY) -execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${mocRerunBinDir}" RESULT_VARIABLE result ) -if (result) - message(SEND_ERROR "Second build of mocRerun failed.") -endif() -# - Acquire binary timestamps after the build -file(TIMESTAMP "${mocRerunBin}" timeAfter "${timeformat}") -# - Test if timestamps changed -if (NOT timeAfter GREATER timeBefore) - message(SEND_ERROR "File (${mocRerunBin}) should have changed!") -endif() - - -message("Changing nothing for a MOC rerun") -# - Acquire binary timestamps before the build -file(TIMESTAMP "${mocRerunBin}" timeBefore "${timeformat}") -# - Ensure that the timestamp would change -# - Change nothing -# - Rebuild -execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) -execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${mocRerunBinDir}" RESULT_VARIABLE result ) -if (result) - message(SEND_ERROR "Third build of mocRerun failed.") -endif() -# - Acquire binary timestamps after the build -file(TIMESTAMP "${mocRerunBin}" timeAfter "${timeformat}") -# - Test if timestamps changed -if (timeAfter GREATER timeBefore) - message(SEND_ERROR "File (${mocRerunBin}) should not have changed!") -endif() diff --git a/Tests/QtAutogenRerun/mocRerun/CMakeLists.txt b/Tests/QtAutogenRerun/mocRerun/CMakeLists.txt deleted file mode 100644 index bafd9cf..0000000 --- a/Tests/QtAutogenRerun/mocRerun/CMakeLists.txt +++ /dev/null @@ -1,33 +0,0 @@ -cmake_minimum_required(VERSION 3.9) -cmake_policy(SET CMP0071 NEW) -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>" > mocRerun.txt) diff --git a/Tests/QtAutogenRerun/mocRerun/input.txt b/Tests/QtAutogenRerun/mocRerun/input.txt deleted file mode 100644 index da62762..0000000 --- a/Tests/QtAutogenRerun/mocRerun/input.txt +++ /dev/null @@ -1 +0,0 @@ -Res1 input. diff --git a/Tests/QtAutogenRerun/mocRerun/main.cpp.in b/Tests/QtAutogenRerun/mocRerun/main.cpp.in deleted file mode 100644 index b37ff61..0000000 --- a/Tests/QtAutogenRerun/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/QtAutogenRerun/mocRerun/res1.qrc b/Tests/QtAutogenRerun/mocRerun/res1.qrc deleted file mode 100644 index fb804b5..0000000 --- a/Tests/QtAutogenRerun/mocRerun/res1.qrc +++ /dev/null @@ -1,5 +0,0 @@ -<RCC> - <qresource prefix="/"> - <file>input.txt</file> - </qresource> -</RCC> diff --git a/Tests/QtAutogenRerun/mocRerun/test1a.h.in b/Tests/QtAutogenRerun/mocRerun/test1a.h.in deleted file mode 100644 index a335046..0000000 --- a/Tests/QtAutogenRerun/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/QtAutogenRerun/mocRerun/test1b.h.in b/Tests/QtAutogenRerun/mocRerun/test1b.h.in deleted file mode 100644 index 6128eeb..0000000 --- a/Tests/QtAutogenRerun/mocRerun/test1b.h.in +++ /dev/null @@ -1,7 +0,0 @@ -#include <QObject> -class Test1 : public QObject -{ - Q_OBJECT -public slots: - void onTst1() {} -}; |