summaryrefslogtreecommitdiffstats
path: root/Source/QtDialog
diff options
context:
space:
mode:
authorSankhesh Jhaveri <sankhesh.jhaveri@kitware.com>2020-12-16 07:17:45 (GMT)
committerBrad King <brad.king@kitware.com>2021-01-05 16:03:30 (GMT)
commit50fcc94bc5f906d7a3427435e8afb3decbbe4cae (patch)
tree236eea6ef93ad221eceeac88b32abbe5b5a5b438 /Source/QtDialog
parent2a2942a42e5066086d16049c3eb92d63ab1fa1d6 (diff)
downloadCMake-50fcc94bc5f906d7a3427435e8afb3decbbe4cae.zip
CMake-50fcc94bc5f906d7a3427435e8afb3decbbe4cae.tar.gz
CMake-50fcc94bc5f906d7a3427435e8afb3decbbe4cae.tar.bz2
cmake-gui: Support installation for both Qt5 and Qt6 plugins
Diffstat (limited to 'Source/QtDialog')
-rw-r--r--Source/QtDialog/CMakeLists.txt24
1 files changed, 17 insertions, 7 deletions
diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt
index 8093ca8..81f9e70 100644
--- a/Source/QtDialog/CMakeLists.txt
+++ b/Source/QtDialog/CMakeLists.txt
@@ -60,10 +60,13 @@ if(CMake_INSTALL_DEPENDENCIES AND (APPLE OR WIN32))
endif()
endfunction()
macro(install_qt_plugin _qt_plugin_name _qt_plugins_var)
- _qt_get_plugin_name_with_version("Qt::${_qt_plugin_name}" _qt_plugin_with_version_name)
- #get_target_property(_qt_plugin_path "${_qt_plugin_with_version_name}" LOCATION)
- if(TARGET "${_qt_plugin_with_version_name}")
- get_target_property(_qt_plugin_path "${_qt_plugin_with_version_name}" LOCATION)
+ if(TARGET "${_qt_plugin_name}")
+ get_target_property(_qt_plugin_path "${_qt_plugin_name}" LOCATION)
+ else()
+ _qt_get_plugin_name_with_version("Qt::${_qt_plugin_name}" _qt_plugin_with_version_name)
+ if(TARGET "${_qt_plugin_with_version_name}")
+ get_target_property(_qt_plugin_path "${_qt_plugin_with_version_name}" LOCATION)
+ endif()
endif()
if(EXISTS "${_qt_plugin_path}")
get_filename_component(_qt_plugin_file "${_qt_plugin_path}" NAME)
@@ -84,10 +87,17 @@ if(CMake_INSTALL_DEPENDENCIES AND (APPLE OR WIN32))
endmacro()
macro(install_qt_plugins _comps _plugins_var)
foreach(_qt_comp ${${_comps}})
- get_target_property(_qt_module_plugins Qt${QT_DEFAULT_MAJOR_VERSION}::${_qt_comp} QT_PLUGINS)
+ if (QT_DEFAULT_MAJOR_VERSION VERSION_LESS 6)
+ set(_qt_module_plugins ${Qt${QT_DEFAULT_MAJOR_VERSION}${_qt_comp}_PLUGINS})
+ else()
+ get_target_property(_qt_module_plugins Qt${QT_DEFAULT_MAJOR_VERSION}::${_qt_comp} QT_PLUGINS)
+ endif()
foreach(_qt_plugin ${_qt_module_plugins})
- find_package(Qt${QT_DEFAULT_MAJOR_VERSION}${_qt_plugin} QUIET
- PATHS ${Qt${QT_DEFAULT_MAJOR_VERSION}${_qt_comp}_DIR})
+ if (QT_DEFAULT_MAJOR_VERSION VERSION_GREATER_EQUAL 6)
+ # Qt6 provides the plugins as individual packages that need to be found.
+ find_package(Qt${QT_DEFAULT_MAJOR_VERSION}${_qt_plugin} QUIET
+ PATHS ${Qt${QT_DEFAULT_MAJOR_VERSION}${_qt_comp}_DIR})
+ endif()
install_qt_plugin(${_qt_plugin} _plugins_var)
endforeach()
endforeach()