diff options
-rw-r--r-- | Source/QtDialog/CMakeLists.txt | 24 |
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() |