diff --git a/cmake/modules/AppTarget.cmake b/cmake/modules/AppTarget.cmake index 9ce7daa..1403445 100644 --- a/cmake/modules/AppTarget.cmake +++ b/cmake/modules/AppTarget.cmake @@ -61,7 +61,8 @@ set_target_properties( CXX_VISIBILITY_PRESET hidden LINK_SEARCH_START_STATIC ${STATIC_LINKAGE} LINK_SEARCH_END_STATIC ${STATIC_LINKAGE} - AUTOGEN_TARGET_DEPENDS "${AUTOGEN_DEPS}") + AUTOGEN_TARGET_DEPENDS "${AUTOGEN_DEPS}" + QT_DEFAULT_PLUGINS "${META_QT_DEFAULT_PLUGINS}") # set properties for macOS bundle and generate icon for macOS bundle if (GUI_TYPE STREQUAL "MACOSX_BUNDLE") diff --git a/cmake/modules/BasicConfig.cmake b/cmake/modules/BasicConfig.cmake index 0b8182b..919038c 100644 --- a/cmake/modules/BasicConfig.cmake +++ b/cmake/modules/BasicConfig.cmake @@ -76,6 +76,14 @@ elseif (CONFIGURATION_TARGET_SUFFIX) set(TARGET_SUFFIX "-${CONFIGURATION_TARGET_SUFFIX}") endif () +# disable linking against default Qt plugins by default +if (NOT DEFINED META_QT_DEFAULT_PLUGINS) + # note: The CMake modules in qtutilities take care of linking against static plugins on their own because old Qt versions + # did not provide any support and one had to do it manually. Considering that with Qt's default my projects end up + # pulling in needlessly many plugins I prefer to keep my current approach and disable Qt's defaults. + set(META_QT_DEFAULT_PLUGINS 0) # needs to be exactly 0, Qt's code uses STREQUAL 0 +endif () + # find standard installation directories - note: Allow overriding CMAKE_INSTALL_LIBDIR and LIB_INSTALL_DIR but don't use the # default from GNUInstallDirs (as an Arch Linux user this feels odd and I also want to avoid breaking existing build # scripts). diff --git a/cmake/modules/LibraryTarget.cmake b/cmake/modules/LibraryTarget.cmake index decd4e9..cf773a4 100644 --- a/cmake/modules/LibraryTarget.cmake +++ b/cmake/modules/LibraryTarget.cmake @@ -157,7 +157,8 @@ else () CXX_VISIBILITY_PRESET hidden LINK_SEARCH_START_STATIC ${STATIC_LINKAGE} LINK_SEARCH_END_STATIC ${STATIC_LINKAGE} - AUTOGEN_TARGET_DEPENDS "${AUTOGEN_DEPS}") + AUTOGEN_TARGET_DEPENDS "${AUTOGEN_DEPS}" + QT_DEFAULT_PLUGINS "${META_QT_DEFAULT_PLUGINS}") if (META_PLUGIN_CATEGORY) set_target_properties(${META_TARGET_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${META_PLUGIN_CATEGORY}") endif ()