diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2018-10-17 14:25:23 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2018-10-19 13:54:10 (GMT) |
commit | 15bbff05818607a8287ab5d4584428ec331005ee (patch) | |
tree | 2e3637dc1bf5db33594fbc26669ac57966611aa7 /Modules | |
parent | 65bea5b90bcee773dba7e958fcdc704c93cca280 (diff) | |
download | CMake-15bbff05818607a8287ab5d4584428ec331005ee.zip CMake-15bbff05818607a8287ab5d4584428ec331005ee.tar.gz CMake-15bbff05818607a8287ab5d4584428ec331005ee.tar.bz2 |
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')
-rw-r--r-- | Modules/BundleUtilities.cmake | 16 | ||||
-rw-r--r-- | Modules/DeployQt4.cmake | 141 |
2 files changed, 86 insertions, 71 deletions
diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake index 31db25a..613ba1a 100644 --- a/Modules/BundleUtilities.cmake +++ b/Modules/BundleUtilities.cmake @@ -224,17 +224,21 @@ that are already also in the bundle... Anything that points to an external file causes this function to fail the verification. #]=======================================================================] +function(_warn_cmp0080) + message(AUTHOR_WARNING + "Policy CMP0080 is not set: BundleUtilities prefers not to be included at configure time. " + "Run \"cmake --help-policy CMP0080\" for policy details. " + "Use the cmake_policy command to set the policy and suppress this warning." + ) +endfunction() + # Do not include this module at configure time! if(DEFINED CMAKE_GENERATOR) cmake_policy(GET CMP0080 _BundleUtilities_CMP0080) if(_BundleUtilities_CMP0080 STREQUAL "NEW") message(FATAL_ERROR "BundleUtilities cannot be included at configure time!") - elseif(NOT _BundleUtilities_CMP0080 STREQUAL "OLD") - message(AUTHOR_WARNING - "Policy CMP0080 is not set: BundleUtilities prefers not to be included at configure time. " - "Run \"cmake --help-policy CMP0080\" for policy details. " - "Use the cmake_policy command to set the policy and suppress this warning." - ) + elseif(NOT _BundleUtilities_CMP0080 STREQUAL "OLD" AND NOT _CMP0080_SUPPRESS_WARNING) + _warn_cmp0080() endif() endif() diff --git a/Modules/DeployQt4.cmake b/Modules/DeployQt4.cmake index 15292f8..c69cd38 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) |