From 3212f1b8662b5e5483a0185c22820e2d14593aba Mon Sep 17 00:00:00 2001 From: Leander Beernaert Date: Tue, 16 Jul 2019 14:22:37 +0200 Subject: Add special case handling for corelib mimetypes resources We have to treat the resources from mimetypes in corelibs specially as they are reused for two test cases. Since we no longer use the qrc files, we have wrapped the relevant code in a function that can be called for every target that depends on it. This change also corrects formatting for the generate CMake code regarding resource commands. Change-Id: I50a05c81151d75aefc9ca165f5ffeb9f5cd77162 Reviewed-by: Simon Hausmann --- tests/auto/corelib/mimetypes/CMakeLists.txt | 14 ++++- .../corelib/mimetypes/qmimedatabase/CMakeLists.txt | 10 +++ .../qmimedatabase-cache/.prev_CMakeLists.txt | 66 ++++++++++++++++++++ .../qmimedatabase-cache/CMakeLists.txt | 72 ++++++++++++++++++++++ .../qmimedatabase/qmimedatabase-xml/CMakeLists.txt | 72 ++++++++++++++++++++++ .../corelib/mimetypes/qmimetype/CMakeLists.txt | 16 ++++- 6 files changed, 248 insertions(+), 2 deletions(-) create mode 100644 tests/auto/corelib/mimetypes/qmimedatabase/CMakeLists.txt create mode 100644 tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/.prev_CMakeLists.txt create mode 100644 tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/CMakeLists.txt create mode 100644 tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/CMakeLists.txt (limited to 'tests/auto/corelib/mimetypes') diff --git a/tests/auto/corelib/mimetypes/CMakeLists.txt b/tests/auto/corelib/mimetypes/CMakeLists.txt index 1e59aa3329..ea0463de36 100644 --- a/tests/auto/corelib/mimetypes/CMakeLists.txt +++ b/tests/auto/corelib/mimetypes/CMakeLists.txt @@ -1,2 +1,14 @@ -# add_subdirectory(qmimetype) +# Generated from mimetypes.pro. +# special case begin +if(FEATURE_private_tests) +# special case end + add_subdirectory(qmimetype) + add_subdirectory(qmimedatabase) +# special case begin +endif() +# special case end + +if(NOT QT_FEATURE_private_tests) + ### remove_subdirectory("qmimetype") +endif() diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/CMakeLists.txt b/tests/auto/corelib/mimetypes/qmimedatabase/CMakeLists.txt new file mode 100644 index 0000000000..6661952a68 --- /dev/null +++ b/tests/auto/corelib/mimetypes/qmimedatabase/CMakeLists.txt @@ -0,0 +1,10 @@ +# Generated from qmimedatabase.pro. + + +if(TARGET Qt::Concurrent) + add_subdirectory(qmimedatabase-xml) + + if(UNIX AND NOT APPLE AND NOT QNX) + add_subdirectory(qmimedatabase-cache) + endif() +endif() diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/.prev_CMakeLists.txt b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/.prev_CMakeLists.txt new file mode 100644 index 0000000000..4a3d150123 --- /dev/null +++ b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/.prev_CMakeLists.txt @@ -0,0 +1,66 @@ +# Generated from qmimedatabase-cache.pro. + +##################################################################### +## tst_qmimedatabase-cache Test: +##################################################################### + +add_qt_test(tst_qmimedatabase-cache + SOURCES + ../tst_qmimedatabase.h + tst_qmimedatabase-cache.cpp + PUBLIC_LIBRARIES + Qt::Concurrent +) + +# Resources: +set_source_files_properties("../qml-again.xml" + PROPERTIES alias "qml-again.xml"] +) +set_source_files_properties("../test.qml" + PROPERTIES alias "test.qml"] +) +set_source_files_properties("../text-x-objcsrc.xml" + PROPERTIES alias "text-x-objcsrc.xml"] +) +set_source_files_properties("../yast2-metapackage-handler-mimetypes.xml" + PROPERTIES alias "yast2-metapackage-handler-mimetypes.xml"] +) +add_qt_resource(tst_qmimedatabase-cache "testdata" + PREFIX + "/qt-project.org/qmime" + BASE + ".." + FILES + invalid-magic1.xml + invalid-magic2.xml + invalid-magic3.xml + magic-and-hierarchy.foo + magic-and-hierarchy.xml + magic-and-hierarchy2.foo + qml-again.xml + test.qml + text-x-objcsrc.xml + yast2-metapackage-handler-mimetypes.xml +) + + +#### Keys ignored in scope 1:.:.:qmimedatabase-cache.pro:: +# CONFIG = "testcase" + +## Scopes: +##################################################################### + +extend_target(tst_qmimedatabase-cache CONDITION 2*_x_ - g + COMPILE_OPTIONS + -W + -Wall + -Wextra + -Wno-long-long + -Wnon-virtual-dtor + -Wshadow +) + +extend_target(tst_qmimedatabase-cache CONDITION UNIX AND NOT APPLE_OSX AND NOT QNX + DEFINES + USE_XDG_DATA_DIRS +) diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/CMakeLists.txt b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/CMakeLists.txt new file mode 100644 index 0000000000..c7e3f9613d --- /dev/null +++ b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/CMakeLists.txt @@ -0,0 +1,72 @@ +# Generated from qmimedatabase-cache.pro. + +##################################################################### +## tst_qmimedatabase-cache Test: +##################################################################### + +add_qt_test(tst_qmimedatabase-cache + SOURCES + ../tst_qmimedatabase.h + tst_qmimedatabase-cache.cpp + PUBLIC_LIBRARIES + Qt::Concurrent +) + +# Resources: +set_source_files_properties("../qml-again.xml" + PROPERTIES alias "qml-again.xml" +) +set_source_files_properties("../test.qml" + PROPERTIES alias "test.qml" +) +set_source_files_properties("../text-x-objcsrc.xml" + PROPERTIES alias "text-x-objcsrc.xml" +) +set_source_files_properties("../yast2-metapackage-handler-mimetypes.xml" + PROPERTIES alias "yast2-metapackage-handler-mimetypes.xml" +) +add_qt_resource(tst_qmimedatabase-cache "testdata" + PREFIX + "/qt-project.org/qmime" + BASE + ".." + FILES + invalid-magic1.xml + invalid-magic2.xml + invalid-magic3.xml + magic-and-hierarchy.foo + magic-and-hierarchy.xml + magic-and-hierarchy2.foo + qml-again.xml + test.qml + text-x-objcsrc.xml + yast2-metapackage-handler-mimetypes.xml +) + +# special case begin +set(corelib_source_dir ../../../../../../src/corelib) +include(${corelib_source_dir}/mimetypes/mimetypes_resources.cmake) +corelib_add_mimetypes_resources(tst_qmimedatabase-cache) +# special case end + +#### Keys ignored in scope 1:.:.:qmimedatabase-cache.pro:: +# CONFIG = "testcase" + +## Scopes: +##################################################################### + +extend_target(tst_qmimedatabase-cache CONDITION CMAKE_COMPILER_IS_GNUCXX + + COMPILE_OPTIONS + -W + -Wall + -Wextra + -Wno-long-long + -Wnon-virtual-dtor + -Wshadow +) + +extend_target(tst_qmimedatabase-cache CONDITION UNIX AND NOT APPLE_OSX AND NOT QNX + DEFINES + USE_XDG_DATA_DIRS +) diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/CMakeLists.txt b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/CMakeLists.txt new file mode 100644 index 0000000000..526b63aafa --- /dev/null +++ b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/CMakeLists.txt @@ -0,0 +1,72 @@ +# Generated from qmimedatabase-xml.pro. + +##################################################################### +## tst_qmimedatabase-xml Test: +##################################################################### + +add_qt_test(tst_qmimedatabase-xml + SOURCES + ../tst_qmimedatabase.h + tst_qmimedatabase-xml.cpp + PUBLIC_LIBRARIES + Qt::ConcurrentPrivate +) + +# Resources: +set_source_files_properties("../qml-again.xml" + PROPERTIES alias "qml-again.xml" +) +set_source_files_properties("../test.qml" + PROPERTIES alias "test.qml" +) +set_source_files_properties("../text-x-objcsrc.xml" + PROPERTIES alias "text-x-objcsrc.xml" +) +set_source_files_properties("../yast2-metapackage-handler-mimetypes.xml" + PROPERTIES alias "yast2-metapackage-handler-mimetypes.xml" +) + +add_qt_resource(tst_qmimedatabase-xml "testdata" + PREFIX + "/qt-project.org/qmime" + BASE + ".." + FILES + invalid-magic1.xml + invalid-magic2.xml + invalid-magic3.xml + magic-and-hierarchy.foo + magic-and-hierarchy.xml + magic-and-hierarchy2.foo + qml-again.xml + test.qml + text-x-objcsrc.xml + yast2-metapackage-handler-mimetypes.xml +) + +# special case begin +set(corelib_source_dir ../../../../../../src/corelib) +include(${corelib_source_dir}/mimetypes/mimetypes_resources.cmake) +corelib_add_mimetypes_resources(tst_qmimedatabase-xml) +# special case end + +#### Keys ignored in scope 1:.:.:qmimedatabase-xml.pro:: +# CONFIG = "testcase" + +## Scopes: +##################################################################### + +extend_target(tst_qmimedatabase-xml CONDITION CMAKE_COMPILER_IS_GNUCXX + COMPILE_OPTIONS + -W + -Wall + -Wextra + -Wno-long-long + -Wnon-virtual-dtor + -Wshadow +) + +extend_target(tst_qmimedatabase-xml CONDITION UNIX AND NOT APPLE_OSX AND NOT QNX + DEFINES + USE_XDG_DATA_DIRS +) diff --git a/tests/auto/corelib/mimetypes/qmimetype/CMakeLists.txt b/tests/auto/corelib/mimetypes/qmimetype/CMakeLists.txt index 9b70d0971a..adfcefb917 100644 --- a/tests/auto/corelib/mimetypes/qmimetype/CMakeLists.txt +++ b/tests/auto/corelib/mimetypes/qmimetype/CMakeLists.txt @@ -1 +1,15 @@ -add_qt_test(tst_qmimetype SOURCES tst_qmimetype.cpp LIBRARIES Qt::CorePrivate) +# Generated from qmimetype.pro. + +##################################################################### +## tst_qmimetype Test: +##################################################################### + +add_qt_test(tst_qmimetype + SOURCES + tst_qmimetype.cpp + LIBRARIES + Qt::CorePrivate +) + +#### Keys ignored in scope 1:.:.:qmimetype.pro:: +# CONFIG = "testcase" -- cgit v1.2.3