Browse Source

Disable linking against default Qt plugins

This change would obviously better go into qtutilities. However, it is
easier done here and doesn't pull in any dependency on Qt anyways.
charconv
Martchus 1 year ago
parent
commit
8a9d72bee9
  1. 3
      cmake/modules/AppTarget.cmake
  2. 8
      cmake/modules/BasicConfig.cmake
  3. 3
      cmake/modules/LibraryTarget.cmake

3
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")

8
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).

3
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 ()

Loading…
Cancel
Save