From 9c1b395860e7e25062e7609fccc43819e938f315 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Mon, 26 Apr 2021 14:54:57 +0200 Subject: CMake: Fix tst_qaddpreroutine to work with static builds DEFAULT_IF needs to be true so that in a static build the built plugin is automatically linked into the test executable using the special static plugin per-repo behavior in qt_internal_add_executable. The QtPostProcess routines are not executed for this test project because we don't use qt_build_repo. This means that no QtFooPluginCMakeConfig.cmake file is generated and thus there's no point in using qt6_import_plugins because the pulic plugin genexes won't know about this target anyway. Explicitly set the CLASS_NAME so that the name expected by the Q_IMPORT_PLUGIN macro matches the name of the plugin instance that moc generates in QT_MOC_EXPORT_PLUGIN. Amends 22e967c3049608f82abd32a0beb0b4b36ee134bf Task-number: QTBUG-87580 Task-number: QTBUG-90341 Change-Id: I5ef361e7e2cebc46b35310c679f15c84cd61b4a5 Reviewed-by: Joerg Bornemann (cherry picked from commit 2fccea3b70d8d88ed49cac1c228362a4cf01bb15) Reviewed-by: Alexey Edelev Reviewed-by: Alexandru Croitor --- tests/auto/cmake/tst_qaddpreroutine/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/auto/cmake/tst_qaddpreroutine/CMakeLists.txt b/tests/auto/cmake/tst_qaddpreroutine/CMakeLists.txt index aab144e520..74de74f7ec 100644 --- a/tests/auto/cmake/tst_qaddpreroutine/CMakeLists.txt +++ b/tests/auto/cmake/tst_qaddpreroutine/CMakeLists.txt @@ -24,8 +24,9 @@ find_package(Qt6 COMPONENTS Gui Test CONFIG REQUIRED) qt_internal_add_plugin(QTBUG_90341ThemePlugin OUTPUT_NAME QTBUG_90341 OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" + CLASS_NAME ThemePlugin TYPE platformthemes - DEFAULT_IF FALSE + DEFAULT_IF TRUE SOURCES plugin.cpp SKIP_INSTALL @@ -42,7 +43,6 @@ qt_internal_add_test(tst_qaddpreroutine Qt::Gui ) -qt6_import_plugins(tst_qaddpreroutine INCLUDE QTBUG_90341) target_compile_definitions(tst_qaddpreroutine PRIVATE QT_QPA_PLATFORM_PLUGIN_PATH=\"${CMAKE_BINARY_DIR}\") -- cgit v1.2.3