summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Holland <dominik.holland@qt.io>2022-08-04 20:19:05 +0200
committerDominik Holland <dominik.holland@qt.io>2022-08-06 13:21:27 +0200
commit4bb22d37f31a8f3fd6773832a2bd7fd20410c537 (patch)
treeffd692506975b5b2c80c62f17a928d7b9d403f5d
parent192283043b09eadd324c6ac1ccb516c3a630588d (diff)
CMake: Don't use qt_internal_add_plugin in autotests
Otherwise all static plugins in our autotests are linked to all applications which are linking to the interfaceframework. Change-Id: Iefcfcdda735dba42fb945a3138169df31833daeb Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Robert Griebl <robert.griebl@qt.io> (cherry picked from commit 468d4c3f9d947d83efe0651675c4f7a71e509527)
-rw-r--r--tests/auto/core/servicemanagertest/simple_plugin/CMakeLists.txt28
-rw-r--r--tests/auto/core/servicemanagertest/simple_plugin_static/CMakeLists.txt27
-rw-r--r--tests/auto/core/servicemanagertest/tst_servicemanagertest.cpp5
-rw-r--r--tests/auto/core/servicemanagertest/wrong_plugin/CMakeLists.txt28
-rw-r--r--tests/auto/core/servicemanagertest/wrongmetadata_plugin/CMakeLists.txt27
-rw-r--r--tests/auto/core/servicemanagertest/wrongmetadata_plugin_static/CMakeLists.txt26
6 files changed, 62 insertions, 79 deletions
diff --git a/tests/auto/core/servicemanagertest/simple_plugin/CMakeLists.txt b/tests/auto/core/servicemanagertest/simple_plugin/CMakeLists.txt
index 21034d00..3b61935f 100644
--- a/tests/auto/core/servicemanagertest/simple_plugin/CMakeLists.txt
+++ b/tests/auto/core/servicemanagertest/simple_plugin/CMakeLists.txt
@@ -4,23 +4,21 @@
## simple_plugin Generic Library:
#####################################################################
-qt_internal_add_plugin(simplePlugin
- OUTPUT_NAME simple_plugin
+qt_add_plugin(simplePlugin
PLUGIN_TYPE interfaceframework
- OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../interfaceframework/"
- SOURCES
- simpleplugin.cpp simpleplugin.h
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
- Qt::InterfaceFramework
)
-#### Keys ignored in scope 1:.:.:simple_plugin.pro:<TRUE>:
-# DISTFILES = "simple_plugin.json"
-# TEMPLATE = "lib"
-
-## Scopes:
-#####################################################################
+target_sources(simplePlugin PRIVATE
+ simpleplugin.cpp
+ simpleplugin.h
+)
qt_autogen_tools_initial_setup(simplePlugin)
+
+set_target_properties(simplePlugin PROPERTIES LIBRARY_OUTPUT_DIRECTORY ../interfaceframework)
+
+target_link_libraries(simplePlugin PRIVATE
+ Qt::Core
+ Qt::Gui
+ Qt::InterfaceFramework
+)
diff --git a/tests/auto/core/servicemanagertest/simple_plugin_static/CMakeLists.txt b/tests/auto/core/servicemanagertest/simple_plugin_static/CMakeLists.txt
index fea7e4de..dc0083d6 100644
--- a/tests/auto/core/servicemanagertest/simple_plugin_static/CMakeLists.txt
+++ b/tests/auto/core/servicemanagertest/simple_plugin_static/CMakeLists.txt
@@ -4,26 +4,21 @@
## simple_plugin_static Generic Library:
#####################################################################
-qt_internal_add_plugin(simpleStaticPlugin
- OUTPUT_NAME simple_plugin_static
+qt_add_plugin(simpleStaticPlugin
PLUGIN_TYPE interfaceframework
+ CLASS_NAME SimpleStaticPlugin
STATIC
- OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../interfaceframework/"
- SOURCES
- simplestaticplugin.cpp simplestaticplugin.h
- LIBRARIES
- Qt::Core
- Qt::Gui
- Qt::InterfaceFramework
)
-#### Keys ignored in scope 1:.:.:simple_plugin_static.pro:<TRUE>:
-# DISTFILES = "simple_plugin.json"
-# TEMPLATE = "lib"
-
-## Scopes:
-#####################################################################
+target_sources(simpleStaticPlugin PRIVATE
+ simplestaticplugin.cpp
+ simplestaticplugin.h
+)
qt_autogen_tools_initial_setup(simpleStaticPlugin)
-target_compile_definitions(simpleStaticPlugin PRIVATE QT_STATICPLUGIN)
+target_link_libraries(simpleStaticPlugin PRIVATE
+ Qt::Core
+ Qt::Gui
+ Qt::InterfaceFramework
+)
diff --git a/tests/auto/core/servicemanagertest/tst_servicemanagertest.cpp b/tests/auto/core/servicemanagertest/tst_servicemanagertest.cpp
index 3d40c6fb..67224e7b 100644
--- a/tests/auto/core/servicemanagertest/tst_servicemanagertest.cpp
+++ b/tests/auto/core/servicemanagertest/tst_servicemanagertest.cpp
@@ -325,7 +325,7 @@ void ServiceManagerTest::pluginLoaderTest()
QCOMPARE(services.count(), 1);
QVERIFY(manager->hasInterface("wrong_plugin"));
- QTest::ignoreMessage(QtWarningMsg, QRegularExpression("ServiceManager::serviceObjects - failed to cast to interface from '.*wrong_plugin.*'"));
+ QTest::ignoreMessage(QtWarningMsg, QRegularExpression("ServiceManager::serviceObjects - failed to cast to interface from '.*wrong.*'"));
QList<QIfServiceObject *> wServices = manager->findServiceByInterface("wrong_plugin");
QCOMPARE(wServices.count(), 0);
@@ -334,9 +334,6 @@ void ServiceManagerTest::pluginLoaderTest()
QCOMPARE(manager->rowCount(), 0);
}
-Q_IMPORT_PLUGIN(SimpleStaticPlugin)
-Q_IMPORT_PLUGIN(WrongMetadataStaticPlugin)
-
QTEST_MAIN(ServiceManagerTest)
#include "tst_servicemanagertest.moc"
diff --git a/tests/auto/core/servicemanagertest/wrong_plugin/CMakeLists.txt b/tests/auto/core/servicemanagertest/wrong_plugin/CMakeLists.txt
index b4f7798b..40a24bbe 100644
--- a/tests/auto/core/servicemanagertest/wrong_plugin/CMakeLists.txt
+++ b/tests/auto/core/servicemanagertest/wrong_plugin/CMakeLists.txt
@@ -4,23 +4,21 @@
## wrong_plugin Generic Library:
#####################################################################
-qt_internal_add_plugin(wrongPlugin
- OUTPUT_NAME wrong_plugin
+qt_add_plugin(wrongPlugin
PLUGIN_TYPE interfaceframework
- OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../interfaceframework/"
- SOURCES
- wrongplugin.cpp wrongplugin.h
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
- Qt::InterfaceFramework
)
-#### Keys ignored in scope 1:.:.:wrong_plugin.pro:<TRUE>:
-# DISTFILES = "wrong_plugin.json"
-# TEMPLATE = "lib"
-
-## Scopes:
-#####################################################################
+target_sources(wrongPlugin PRIVATE
+ wrongplugin.cpp
+ wrongplugin.h
+)
qt_autogen_tools_initial_setup(wrongPlugin)
+
+set_target_properties(wrongPlugin PROPERTIES LIBRARY_OUTPUT_DIRECTORY ../interfaceframework)
+
+target_link_libraries(wrongPlugin PRIVATE
+ Qt::Core
+ Qt::Gui
+ Qt::InterfaceFramework
+)
diff --git a/tests/auto/core/servicemanagertest/wrongmetadata_plugin/CMakeLists.txt b/tests/auto/core/servicemanagertest/wrongmetadata_plugin/CMakeLists.txt
index b949e093..5ec4c2d5 100644
--- a/tests/auto/core/servicemanagertest/wrongmetadata_plugin/CMakeLists.txt
+++ b/tests/auto/core/servicemanagertest/wrongmetadata_plugin/CMakeLists.txt
@@ -4,22 +4,21 @@
## wrongmetadata_plugin Generic Library:
#####################################################################
-qt_internal_add_plugin(wrongmetadataPlugin
- OUTPUT_NAME wrongmetadata_plugin
+qt_add_plugin(wrongmetadataPlugin
PLUGIN_TYPE interfaceframework
- OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../interfaceframework/"
- SOURCES
- wrongmetadataplugin.cpp wrongmetadataplugin.h
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
- Qt::InterfaceFramework
)
-#### Keys ignored in scope 1:.:.:wrongmetadata_plugin.pro:<TRUE>:
-# TEMPLATE = "lib"
-
-## Scopes:
-#####################################################################
+target_sources(wrongmetadataPlugin PRIVATE
+ wrongmetadataplugin.cpp
+ wrongmetadataplugin.h
+)
qt_autogen_tools_initial_setup(wrongmetadataPlugin)
+
+set_target_properties(wrongmetadataPlugin PROPERTIES LIBRARY_OUTPUT_DIRECTORY ../interfaceframework)
+
+target_link_libraries(wrongmetadataPlugin PRIVATE
+ Qt::Core
+ Qt::Gui
+ Qt::InterfaceFramework
+)
diff --git a/tests/auto/core/servicemanagertest/wrongmetadata_plugin_static/CMakeLists.txt b/tests/auto/core/servicemanagertest/wrongmetadata_plugin_static/CMakeLists.txt
index 83adb29c..439b4c09 100644
--- a/tests/auto/core/servicemanagertest/wrongmetadata_plugin_static/CMakeLists.txt
+++ b/tests/auto/core/servicemanagertest/wrongmetadata_plugin_static/CMakeLists.txt
@@ -4,25 +4,21 @@
## wrongmetadata_plugin_static Generic Library:
#####################################################################
-qt_internal_add_plugin(wrongmetadataStaticPlugin
- OUTPUT_NAME wrongmetadata_plugin_static
+qt_add_plugin(wrongmetadataStaticPlugin
PLUGIN_TYPE interfaceframework
+ CLASS_NAME WrongMetadataStaticPlugin
STATIC
- OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../interfaceframework/"
- SOURCES
- wrongmetadatastaticplugin.cpp wrongmetadatastaticplugin.h
- LIBRARIES
- Qt::Core
- Qt::Gui
- Qt::InterfaceFramework
)
-#### Keys ignored in scope 1:.:.:wrongmetadata_plugin_static.pro:<TRUE>:
-# TEMPLATE = "lib"
-
-## Scopes:
-#####################################################################
+target_sources(wrongmetadataStaticPlugin PRIVATE
+ wrongmetadatastaticplugin.cpp
+ wrongmetadatastaticplugin.h
+)
qt_autogen_tools_initial_setup(wrongmetadataStaticPlugin)
-target_compile_definitions(wrongmetadataStaticPlugin PRIVATE QT_STATICPLUGIN)
+target_link_libraries(wrongmetadataStaticPlugin PRIVATE
+ Qt::Core
+ Qt::Gui
+ Qt::InterfaceFramework
+)