mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-08 14:50:10 -06:00
cmake-gui: Install only necessary plugins for Qt 6
This commit is contained in:
@@ -105,32 +105,15 @@ if(CMake_INSTALL_DEPENDENCIES AND (APPLE OR WIN32))
|
||||
"${${_qt_plugins_var}};\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${_qt_plugin_dest}/${_qt_plugin_file}")
|
||||
endif()
|
||||
endmacro()
|
||||
macro(install_qt_plugins _comps _plugins_var)
|
||||
foreach(_qt_comp IN LISTS ${_comps})
|
||||
if(CMake_QT_MAJOR_VERSION VERSION_LESS 6)
|
||||
set(_qt_module_plugins ${Qt${CMake_QT_MAJOR_VERSION}${_qt_comp}_PLUGINS})
|
||||
else()
|
||||
get_target_property(_qt_module_plugins Qt${CMake_QT_MAJOR_VERSION}::${_qt_comp} QT_PLUGINS)
|
||||
endif()
|
||||
foreach(_qt_plugin IN LISTS _qt_module_plugins)
|
||||
if(CMake_QT_MAJOR_VERSION VERSION_GREATER_EQUAL 6)
|
||||
# Qt6 provides the plugins as individual packages that need to be found.
|
||||
find_package(Qt${CMake_QT_MAJOR_VERSION}${_qt_plugin} QUIET
|
||||
PATHS ${Qt${CMake_QT_MAJOR_VERSION}${_qt_comp}_DIR})
|
||||
endif()
|
||||
install_qt_plugin("${_qt_plugin}" "${_plugins_var}")
|
||||
endforeach()
|
||||
endforeach()
|
||||
endmacro()
|
||||
if(APPLE)
|
||||
if(CMake_QT_MAJOR_VERSION VERSION_EQUAL 5)
|
||||
install_qt_plugin("Qt5::QCocoaIntegrationPlugin" QT_PLUGINS)
|
||||
if(TARGET Qt5::QMacStylePlugin)
|
||||
install_qt_plugin("Qt5::QMacStylePlugin" QT_PLUGINS)
|
||||
endif()
|
||||
else()
|
||||
# FIXME: Minimize plugins for Qt6.
|
||||
install_qt_plugins(QT_COMPONENTS QT_PLUGINS)
|
||||
if(CMake_QT_MAJOR_VERSION VERSION_GREATER_EQUAL 6)
|
||||
# Qt6 provides the plugins as individual packages that need to be found.
|
||||
find_package(Qt${CMake_QT_MAJOR_VERSION}QCocoaIntegrationPlugin QUIET PATHS ${Qt${CMake_QT_MAJOR_VERSION}Gui_DIR})
|
||||
find_package(Qt${CMake_QT_MAJOR_VERSION}QMacStylePlugin QUIET PATHS ${Qt${CMake_QT_MAJOR_VERSION}Widgets_DIR})
|
||||
endif()
|
||||
install_qt_plugin("Qt${CMake_QT_MAJOR_VERSION}::QCocoaIntegrationPlugin" QT_PLUGINS)
|
||||
if(TARGET Qt${CMake_QT_MAJOR_VERSION}::QMacStylePlugin)
|
||||
install_qt_plugin("Qt${CMake_QT_MAJOR_VERSION}::QMacStylePlugin" QT_PLUGINS)
|
||||
endif()
|
||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/qt.conf"
|
||||
"[Paths]\nPlugins = ${_qt_plugin_dir}\n")
|
||||
@@ -138,12 +121,11 @@ if(CMake_INSTALL_DEPENDENCIES AND (APPLE OR WIN32))
|
||||
DESTINATION "${CMake_INSTALL_APP_DIR_SLASH}Resources"
|
||||
${COMPONENT})
|
||||
elseif(WIN32 AND NOT CMake_QT_STATIC_QWindowsIntegrationPlugin_LIBRARIES)
|
||||
if(CMake_QT_MAJOR_VERSION VERSION_EQUAL 5)
|
||||
install_qt_plugin("Qt5::QWindowsIntegrationPlugin" QT_PLUGINS)
|
||||
else()
|
||||
# FIXME: Minimize plugins for Qt6.
|
||||
install_qt_plugins(QT_COMPONENTS QT_PLUGINS)
|
||||
if(CMake_QT_MAJOR_VERSION VERSION_GREATER_EQUAL 6)
|
||||
# Qt6 provides the plugins as individual packages that need to be found.
|
||||
find_package(Qt${CMake_QT_MAJOR_VERSION}QWindowsIntegrationPlugin QUIET PATHS ${Qt${CMake_QT_MAJOR_VERSION}Gui_DIR})
|
||||
endif()
|
||||
install_qt_plugin("Qt${CMake_QT_MAJOR_VERSION}::QWindowsIntegrationPlugin" QT_PLUGINS)
|
||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/qt.conf"
|
||||
"[Paths]\nPlugins = ../${_qt_plugin_dir}\n")
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/qt.conf"
|
||||
|
||||
Reference in New Issue
Block a user