diff options
author | David Cole <david.cole@kitware.com> | 2012-03-06 20:25:02 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2012-03-06 20:25:02 (GMT) |
commit | b22f2f18c1d195972c2ae1ae68fc06c06acc02db (patch) | |
tree | 03ab8e19340aa03b90a373f50d4eeafcb78bd073 /Modules | |
parent | 480ba6434399052553b31c97e399b44a1491aac9 (diff) | |
parent | 4689eedcc0a1cd73a95dbce583c9470319312b80 (diff) | |
download | CMake-b22f2f18c1d195972c2ae1ae68fc06c06acc02db.zip CMake-b22f2f18c1d195972c2ae1ae68fc06c06acc02db.tar.gz CMake-b22f2f18c1d195972c2ae1ae68fc06c06acc02db.tar.bz2 |
Merge topic 'qt4-deploy'
4689eed reflect that the QtAutomoc depends on QtGui
ab9661c Remove QtGui dependency in Qt4Deploy test and verify QtSql existance.
52e8279 Fix for Qt4Deploy on some test machines.
672e3bb Add test for DeployQt4.cmake
4853e1e Fix plugin installation issues.
35cbf23 Ensure libs are passed to BundleUtilities.
0ac1535 Fix bad plugin paths.
a2123e8 Fix mismatched arguments.
fc6f340 Don't use QT_LIBRARIES_PLUGINS by default.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/DeployQt4.cmake | 72 |
1 files changed, 41 insertions, 31 deletions
diff --git a/Modules/DeployQt4.cmake b/Modules/DeployQt4.cmake index 83f322c..8a5e9c5 100644 --- a/Modules/DeployQt4.cmake +++ b/Modules/DeployQt4.cmake @@ -82,6 +82,7 @@ include(BundleUtilities) set(DeployQt4_cmake_dir "${CMAKE_CURRENT_LIST_DIR}") +set(DeployQt4_apple_plugins_dir "PlugIns") function(write_qt4_conf qt_conf_dir qt_conf_contents) set(qt_conf_path "${qt_conf_dir}/qt.conf") @@ -130,6 +131,9 @@ function(fixup_qt4_executable executable) set(qt_conf_dir "${executable}/Contents/Resources") set(executable_path "${executable}") set(write_qt_conf TRUE) + if(NOT plugins_dir) + set(plugins_dir "${DeployQt4_apple_plugins_dir}") + endif() else() get_filename_component(executable_path "${executable}" PATH) if(NOT executable_path) @@ -141,7 +145,7 @@ function(fixup_qt4_executable executable) foreach(plugin ${qtplugins}) set(installed_plugin_path "") - install_qt4_plugin("${plugin}" "${plugins_dir}" "${executable}" 1 installed_plugin_path) + install_qt4_plugin("${plugin}" "${executable}" 1 installed_plugin_path) list(APPEND libs ${installed_plugin_path}) endforeach() @@ -166,23 +170,19 @@ function(install_qt4_plugin_path plugin executable copy installed_plugin_path_va set(component ${ARGV5}) set(configurations ${ARGV6}) if(EXISTS "${plugin}") - if(plugins_dir) - set(plugins_dir "${plugins_dir}") - else() - if(APPLE) - set(plugins_dir "PlugIns") - else() - set(plugins_dir "plugins") - endif() - endif() if(APPLE) + if(NOT plugins_dir) + set(plugins_dir "${DeployQt4_apple_plugins_dir}") + endif() set(plugins_path "${executable}/Contents/${plugins_dir}") else() - get_filename_component(executable_path "${executable}" PATH) - if(NOT executable_path) - set(executable_path ".") + get_filename_component(plugins_path "${executable}" PATH) + if(NOT plugins_path) + set(plugins_path ".") + endif() + if(plugins_dir) + set(plugins_path "${plugins_path}/${plugins_dir}") endif() - set(plugins_path "${executable_path}/${plugins_dir}") endif() set(plugin_group "") @@ -210,7 +210,7 @@ function(install_qt4_plugin_path plugin executable copy installed_plugin_path_va endif() install(FILES "${plugin}" DESTINATION "${plugins_path}" ${configurations} ${component}) endif() - set(${installed_plugin_path_var} ${${installed_path_var}} "${plugins_path}/${plugin_name}" PARENT_SCOPE) + set(${installed_plugin_path_var} "${plugins_path}/${plugin_name}" PARENT_SCOPE) endif() endfunction() @@ -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_path_var "${installed_plugin_path_var}" PARENT_SCOPE) + set(${installed_plugin_path_var} ${${installed_plugin_path_var}} PARENT_SCOPE) endfunction() function(install_qt4_executable executable) @@ -264,16 +274,16 @@ function(install_qt4_executable executable) set(qt_plugins_dir "") endif() - if(NOT qtplugins AND QT_LIBRARIES_PLUGINS) - set(qtplugins "${QT_LIBRARIES_PLUGINS}") + 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() - 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() - resolve_qt4_paths(libs) install(CODE |