Autogen: Fix for Q_PLUGIN_METADATA change detection test

This commit is contained in:
Sebastian Holtermann
2017-02-24 18:27:41 +01:00
parent badc2c44d8
commit 48b56504bf
4 changed files with 44 additions and 43 deletions
+37 -36
View File
@@ -232,55 +232,56 @@ if (NOT QT_TEST_VERSION STREQUAL 4)
endif() endif()
set(timeformat "%Y%j%H%M%S") set(timeformat "%Y%j%H%M%S")
set(mocPluginBinDir "${CMAKE_CURRENT_BINARY_DIR}/mocPlugin") set(mocPlugSrcDir "${CMAKE_CURRENT_SOURCE_DIR}/mocPlugin")
find_library(style_a_file "PluginStyleA" "${mocPluginBinDir}") set(mocPlugBinDir "${CMAKE_CURRENT_BINARY_DIR}/mocPlugin")
find_library(style_b_file "PluginStyleB" "${mocPluginBinDir}") find_library(plAFile "PlugA" PATHS "${mocPlugBinDir}" NO_DEFAULT_PATH)
find_library(style_c_file "PluginStyleC" "${mocPluginBinDir}") find_library(plBFile "PlugB" PATHS "${mocPlugBinDir}" NO_DEFAULT_PATH)
find_library(style_d_file "PluginStyleD" "${mocPluginBinDir}") find_library(plCFile "PlugC" PATHS "${mocPlugBinDir}" NO_DEFAULT_PATH)
find_library(plDFile "PlugD" PATHS "${mocPlugBinDir}" NO_DEFAULT_PATH)
file(TIMESTAMP "${style_a_file}" style_a_before "${timeformat}") file(TIMESTAMP "${plAFile}" plABefore "${timeformat}")
file(TIMESTAMP "${style_b_file}" style_b_before "${timeformat}") file(TIMESTAMP "${plBFile}" plBBefore "${timeformat}")
file(TIMESTAMP "${style_c_file}" style_c_before "${timeformat}") file(TIMESTAMP "${plCFile}" plCBefore "${timeformat}")
file(TIMESTAMP "${style_d_file}" style_d_before "${timeformat}") file(TIMESTAMP "${plDFile}" plDBefore "${timeformat}")
# Ensure that the timestamp will change and touch the json files # Ensure that the timestamp will change and change the json files
execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${mocPluginBinDir}/jsonFiles/StyleC.json") configure_file("${mocPlugSrcDir}/jsonIn/StyleD.json" "${mocPlugBinDir}/jsonFiles/StyleC.json")
execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${mocPluginBinDir}/jsonFiles/sub/StyleD.json") configure_file("${mocPlugSrcDir}/jsonIn/StyleC.json" "${mocPlugBinDir}/jsonFiles/sub/StyleD.json")
execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${mocPluginBinDir}") execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${mocPlugBinDir}")
file(TIMESTAMP "${style_a_file}" style_a_after "${timeformat}") file(TIMESTAMP "${plAFile}" plAAfter "${timeformat}")
file(TIMESTAMP "${style_b_file}" style_b_after "${timeformat}") file(TIMESTAMP "${plBFile}" plBAfter "${timeformat}")
file(TIMESTAMP "${style_c_file}" style_c_after "${timeformat}") file(TIMESTAMP "${plCFile}" plCAfter "${timeformat}")
file(TIMESTAMP "${style_d_file}" style_d_after "${timeformat}") file(TIMESTAMP "${plDFile}" plDAfter "${timeformat}")
if (style_a_after GREATER style_a_before) if (plAAfter GREATER plABefore)
message(SEND_ERROR "file (${style_a_file}) should not have changed!") message(SEND_ERROR "file (${plAFile}) should not have changed!")
endif() endif()
if (style_b_after GREATER style_b_before) if (plBAfter GREATER plBBefore)
message(SEND_ERROR "file (${style_b_file}) should not have changed!") message(SEND_ERROR "file (${plBFile}) should not have changed!")
endif() endif()
if (NOT style_c_after GREATER style_c_before) if (NOT plCAfter GREATER plCBefore)
message(SEND_ERROR "file (${style_c_file}) should have changed!") message(SEND_ERROR "file (${plCFile}) should have changed!")
endif() endif()
if (NOT style_d_after GREATER style_d_before) if (NOT plDAfter GREATER plDBefore)
message(SEND_ERROR "file (${style_d_file}) should have changed!") message(SEND_ERROR "file (${plDFile}) should have changed!")
endif() endif()
# Test custom macro # Test custom macro
file(TIMESTAMP "${style_c_file}" style_c_before "${timeformat}") file(TIMESTAMP "${plCFile}" plCBefore "${timeformat}")
file(TIMESTAMP "${style_d_file}" style_d_before "${timeformat}") file(TIMESTAMP "${plDFile}" plDBefore "${timeformat}")
execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${mocPluginBinDir}/jsonFiles/StyleC_Custom.json") configure_file("${mocPlugSrcDir}/jsonIn/StyleD.json" "${mocPlugBinDir}/jsonFiles/StyleC_Custom.json")
execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${mocPluginBinDir}/jsonFiles/sub/StyleD_Custom.json") configure_file("${mocPlugSrcDir}/jsonIn/StyleC.json" "${mocPlugBinDir}/jsonFiles/sub/StyleD_Custom.json")
execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${mocPluginBinDir}") execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${mocPlugBinDir}")
file(TIMESTAMP "${style_c_file}" style_c_after "${timeformat}") file(TIMESTAMP "${plCFile}" plCAfter "${timeformat}")
file(TIMESTAMP "${style_d_file}" style_d_after "${timeformat}") file(TIMESTAMP "${plDFile}" plDAfter "${timeformat}")
if (NOT style_c_after GREATER style_c_before) if (NOT plCAfter GREATER plCBefore)
message(SEND_ERROR "file (${style_c_file}) should have changed!") message(SEND_ERROR "file (${plCFile}) should have changed!")
endif() endif()
if (NOT style_d_after GREATER style_d_before) if (NOT plDAfter GREATER plDBefore)
message(SEND_ERROR "file (${style_d_file}) should have changed!") message(SEND_ERROR "file (${plDFile}) should have changed!")
endif() endif()
endif() endif()
+5 -5
View File
@@ -25,8 +25,8 @@ set(CMAKE_AUTOMOC TRUE)
include_directories("${CMAKE_CURRENT_BINARY_DIR}/jsonFiles") include_directories("${CMAKE_CURRENT_BINARY_DIR}/jsonFiles")
link_libraries(Qt5::Widgets) link_libraries(Qt5::Widgets)
add_library(PluginStyleA MODULE StyleA.cpp) add_library(PlugA STATIC StyleA.cpp)
add_library(PluginStyleB MODULE StyleB.cpp) add_library(PlugB STATIC StyleB.cpp)
add_library(PluginStyleC MODULE StyleC.cpp) add_library(PlugC STATIC StyleC.cpp)
add_library(PluginStyleD MODULE StyleD.cpp) add_library(PlugD STATIC StyleD.cpp)
add_library(PluginStyleE MODULE StyleE.cpp) add_library(PlugE STATIC StyleE.cpp)
+1 -1
View File
@@ -1 +1 @@
{ "Keys": [ "Rocket", "StarbusterC" ] } { "Keys": [ "Boat", "Ship" ] }
+1 -1
View File
@@ -1 +1 @@
{ "Keys": [ "Rocket", "StarbusterD" ] } { "Keys": [ "Bike", "Car" ] }