summaryrefslogtreecommitdiff
path: root/Modules/DeployQt4.cmake
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2018-10-17 10:25:23 -0400
committerKyle Edwards <kyle.edwards@kitware.com>2018-10-19 09:54:10 -0400
commit15bbff05818607a8287ab5d4584428ec331005ee (patch)
tree2e3637dc1bf5db33594fbc26669ac57966611aa7 /Modules/DeployQt4.cmake
parent65bea5b90bcee773dba7e958fcdc704c93cca280 (diff)
downloadcmake-15bbff05818607a8287ab5d4584428ec331005ee.tar.gz
DeployQt4: Do not include BundleUtilities at configure time
Due to CMP0080, BundleUtilities can no longer be included at configure-time. However, DeployQt4 contains some functions which are meant to be used at configure-time, and some which are meant to be used at install-time and use BundleUtilities. This change breaks the file into two sections: common functions and install-time functions. BundleUtilities is now only included at install-time, thus fixing the policy warning. Fixes: #18466
Diffstat (limited to 'Modules/DeployQt4.cmake')
-rw-r--r--Modules/DeployQt4.cmake141
1 files changed, 76 insertions, 65 deletions
diff --git a/Modules/DeployQt4.cmake b/Modules/DeployQt4.cmake
index 15292f80a6..c69cd3885c 100644
--- a/Modules/DeployQt4.cmake
+++ b/Modules/DeployQt4.cmake
@@ -106,7 +106,6 @@ and plugin installation. See documentation of FIXUP_QT4_BUNDLE.
# The functions defined in this file depend on the fixup_bundle function
# (and others) found in BundleUtilities.cmake
-include("${CMAKE_CURRENT_LIST_DIR}/BundleUtilities.cmake")
set(DeployQt4_cmake_dir "${CMAKE_CURRENT_LIST_DIR}")
set(DeployQt4_apple_plugins_dir "PlugIns")
@@ -137,80 +136,92 @@ function(resolve_qt4_paths paths_var)
set(${paths_var} ${paths_resolved} PARENT_SCOPE)
endfunction()
-function(fixup_qt4_executable executable)
- unset(qtplugins)
- if(ARGC GREATER 1)
- set(qtplugins ${ARGV1})
- endif()
- unset(libs)
- if(ARGC GREATER 2)
- set(libs ${ARGV2})
- endif()
- unset(dirs)
- if(ARGC GREATER 3)
- set(dirs ${ARGV3})
- endif()
- unset(plugins_dir)
- if(ARGC GREATER 4)
- set(plugins_dir ${ARGV4})
- endif()
- unset(request_qt_conf)
- if(ARGC GREATER 5)
- set(request_qt_conf ${ARGV5})
- endif()
+cmake_policy(GET CMP0080 _cmp0080_value)
+if(NOT DEFINED CMAKE_GENERATOR OR NOT _cmp0080_value STREQUAL "NEW")
+ set(_CMP0080_SUPPRESS_WARNING TRUE)
+ include("${CMAKE_CURRENT_LIST_DIR}/BundleUtilities.cmake")
+ unset(_CMP0080_SUPPRESS_WARNING)
- message(STATUS "fixup_qt4_executable")
- message(STATUS " executable='${executable}'")
- message(STATUS " qtplugins='${qtplugins}'")
- message(STATUS " libs='${libs}'")
- message(STATUS " dirs='${dirs}'")
- message(STATUS " plugins_dir='${plugins_dir}'")
- message(STATUS " request_qt_conf='${request_qt_conf}'")
-
- if(QT_LIBRARY_DIR)
- list(APPEND dirs "${QT_LIBRARY_DIR}")
- endif()
- if(QT_BINARY_DIR)
- list(APPEND dirs "${QT_BINARY_DIR}")
- endif()
+ function(fixup_qt4_executable executable)
+ cmake_policy(GET CMP0080 _cmp0080_value)
+ if(_cmp0080_value STREQUAL "" AND DEFINED CMAKE_GENERATOR)
+ _warn_cmp0080()
+ endif()
- if(APPLE)
- set(qt_conf_dir "${executable}/Contents/Resources")
- set(executable_path "${executable}")
- set(write_qt_conf TRUE)
- if(NOT DEFINED plugins_dir)
- set(plugins_dir "${DeployQt4_apple_plugins_dir}")
+ unset(qtplugins)
+ if(ARGC GREATER 1)
+ set(qtplugins ${ARGV1})
endif()
- else()
- get_filename_component(executable_path "${executable}" PATH)
- if(NOT executable_path)
- set(executable_path ".")
+ unset(libs)
+ if(ARGC GREATER 2)
+ set(libs ${ARGV2})
+ endif()
+ unset(dirs)
+ if(ARGC GREATER 3)
+ set(dirs ${ARGV3})
+ endif()
+ unset(plugins_dir)
+ if(ARGC GREATER 4)
+ set(plugins_dir ${ARGV4})
+ endif()
+ unset(request_qt_conf)
+ if(ARGC GREATER 5)
+ set(request_qt_conf ${ARGV5})
endif()
- set(qt_conf_dir "${executable_path}")
- set(write_qt_conf ${request_qt_conf})
- endif()
- foreach(plugin ${qtplugins})
- set(installed_plugin_path "")
- install_qt4_plugin("${plugin}" "${executable}" 1 installed_plugin_path)
- list(APPEND libs ${installed_plugin_path})
- endforeach()
+ message(STATUS "fixup_qt4_executable")
+ message(STATUS " executable='${executable}'")
+ message(STATUS " qtplugins='${qtplugins}'")
+ message(STATUS " libs='${libs}'")
+ message(STATUS " dirs='${dirs}'")
+ message(STATUS " plugins_dir='${plugins_dir}'")
+ message(STATUS " request_qt_conf='${request_qt_conf}'")
- foreach(lib ${libs})
- if(NOT EXISTS "${lib}")
- message(FATAL_ERROR "Library does not exist: ${lib}")
+ if(QT_LIBRARY_DIR)
+ list(APPEND dirs "${QT_LIBRARY_DIR}")
+ endif()
+ if(QT_BINARY_DIR)
+ list(APPEND dirs "${QT_BINARY_DIR}")
+ endif()
+
+ if(APPLE)
+ set(qt_conf_dir "${executable}/Contents/Resources")
+ set(executable_path "${executable}")
+ set(write_qt_conf TRUE)
+ if(NOT DEFINED plugins_dir)
+ set(plugins_dir "${DeployQt4_apple_plugins_dir}")
+ endif()
+ else()
+ get_filename_component(executable_path "${executable}" PATH)
+ if(NOT executable_path)
+ set(executable_path ".")
+ endif()
+ set(qt_conf_dir "${executable_path}")
+ set(write_qt_conf ${request_qt_conf})
endif()
- endforeach()
- resolve_qt4_paths(libs "${executable_path}")
+ foreach(plugin ${qtplugins})
+ set(installed_plugin_path "")
+ install_qt4_plugin("${plugin}" "${executable}" 1 installed_plugin_path)
+ list(APPEND libs ${installed_plugin_path})
+ endforeach()
- if(write_qt_conf)
- set(qt_conf_contents "[Paths]\nPlugins = ${plugins_dir}")
- write_qt4_conf("${qt_conf_dir}" "${qt_conf_contents}")
- endif()
+ foreach(lib ${libs})
+ if(NOT EXISTS "${lib}")
+ message(FATAL_ERROR "Library does not exist: ${lib}")
+ endif()
+ endforeach()
- fixup_bundle("${executable}" "${libs}" "${dirs}")
-endfunction()
+ resolve_qt4_paths(libs "${executable_path}")
+
+ if(write_qt_conf)
+ set(qt_conf_contents "[Paths]\nPlugins = ${plugins_dir}")
+ write_qt4_conf("${qt_conf_dir}" "${qt_conf_contents}")
+ endif()
+
+ fixup_bundle("${executable}" "${libs}" "${dirs}")
+ endfunction()
+endif()
function(install_qt4_plugin_path plugin executable copy installed_plugin_path_var)
unset(plugins_dir)