Bläddra i källkod

Fix plugin installation issues.

Mike McQuaid 13 år sedan
förälder
incheckning
4853e1effd
1 ändrade filer med 27 tillägg och 13 borttagningar
  1. 27 13
      Modules/DeployQt4.cmake

+ 27 - 13
Modules/DeployQt4.cmake

@@ -220,11 +220,7 @@ function(install_qt4_plugin plugin executable copy installed_plugin_path_var)
         if(EXISTS "${plugin}")
                 install_qt4_plugin_path("${plugin}" "${executable}" "${copy}" "${installed_plugin_path_var}" "${plugins_dir}" "${component}")
         else()
-                if(QT_IS_STATIC)
-                        string(TOUPPER "QT_${plugin}_LIBRARY" plugin_var)
-                else()
-                        string(TOUPPER "QT_${plugin}_PLUGIN" plugin_var)
-                endif()
+                string(TOUPPER "QT_${plugin}_PLUGIN" plugin_var)
                 set(plugin_release_var "${plugin_var}_RELEASE")
                 set(plugin_debug_var "${plugin_var}_DEBUG")
                 set(plugin_release "${${plugin_release_var}}")
@@ -232,10 +228,24 @@ function(install_qt4_plugin plugin executable copy installed_plugin_path_var)
                 if(DEFINED "${plugin_release_var}" AND DEFINED "${plugin_debug_var}" AND NOT EXISTS "${plugin_release}" AND NOT EXISTS "${plugin_debug}")
                         message(WARNING "Qt plugin \"${plugin}\" not recognized or found.")
                 endif()
-                install_qt4_plugin_path("${plugin_release}" "${executable}" "${copy}" "${installed_plugin_path_var}" "${plugins_dir}" "${component}" "Release|RelWithDebInfo|MinSizeRel")
-                install_qt4_plugin_path("${plugin_debug}" "${executable}" "${copy}" "${installed_plugin_path_var}" "${plugins_dir}" "${component}" "Debug")
+                if(NOT EXISTS "${${plugin_debug_var}}")
+                        set(plugin_debug "${plugin_release}")
+                endif()
+
+                if(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
+                        install_qt4_plugin_path("${plugin_release}" "${executable}" "${copy}" "${installed_plugin_path_var}_release" "${plugins_dir}" "${component}" "Release|RelWithDebInfo|MinSizeRel")
+                        install_qt4_plugin_path("${plugin_debug}" "${executable}" "${copy}" "${installed_plugin_path_var}_debug" "${plugins_dir}" "${component}" "Debug")
+
+                        if(CMAKE_BUILD_TYPE MATCHES "^Debug$")
+                                set(${installed_plugin_path_var} ${${installed_plugin_path_var}_debug})
+                        else()
+                                set(${installed_plugin_path_var} ${${installed_plugin_path_var}_release})
+                        endif()
+                else()
+                        install_qt4_plugin_path("${plugin_release}" "${executable}" "${copy}" "${installed_plugin_path_var}" "${plugins_dir}" "${component}")
+                endif()
         endif()
-        set(installed_plugin_paths ${${installed_plugin_path_var}} PARENT_SCOPE)
+        set(${installed_plugin_path_var} ${${installed_plugin_path_var}} PARENT_SCOPE)
 endfunction()
 
 function(install_qt4_executable executable)
@@ -264,11 +274,15 @@ function(install_qt4_executable executable)
                 set(qt_plugins_dir "")
         endif()
 
-        foreach(plugin ${qtplugins})
-                set(installed_plugin_paths "")
-                install_qt4_plugin("${plugin}" "${executable}" 0 installed_plugin_paths "${plugins_dir}" "${component}")
-                list(APPEND libs ${installed_plugin_paths})
-        endforeach()
+        if(QT_IS_STATIC)
+                message(WARNING "Qt built statically: not installing plugins.")
+        else()
+                foreach(plugin ${qtplugins})
+                        set(installed_plugin_paths "")
+                        install_qt4_plugin("${plugin}" "${executable}" 0 installed_plugin_paths "${plugins_dir}" "${component}")
+                        list(APPEND libs ${installed_plugin_paths})
+                endforeach()
+        endif()
 
         resolve_qt4_paths(libs)