summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@qt.io>2021-08-31 15:56:00 +1000
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-09-06 13:56:37 +0000
commitdaf64298ca6cae1243b7756d3b82ea24cbfee9cd (patch)
tree4a60e0d16fc9ebbd729e19fa6693ac362ab84b98
parent0baf73e8bd1a872ca234bd581ac7fba0c60d6f88 (diff)
Revert "Ensure versionless wrappers do not introduce a new variable scope"
This reverts commit 08180e76e6116f0ef66476ca00b2b676b3aa50da. Macros add another level of escaping that functions do not. The conversion of the versionless wrappers to macros may alter the behavior, so revert that change. Task-number: QTBUG-96219 Change-Id: Ic5dcff3081123d957888584ba1d76ae0580d9083 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit a37789e4931a85fce4fba9c9612ebb4020572d54) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/corelib/Qt6AndroidMacros.cmake12
-rw-r--r--src/corelib/Qt6CoreMacros.cmake77
-rw-r--r--src/dbus/Qt6DBusMacros.cmake31
-rw-r--r--src/widgets/Qt6WidgetsMacros.cmake9
4 files changed, 69 insertions, 60 deletions
diff --git a/src/corelib/Qt6AndroidMacros.cmake b/src/corelib/Qt6AndroidMacros.cmake
index 9b68d57001..c5f04c49bc 100644
--- a/src/corelib/Qt6AndroidMacros.cmake
+++ b/src/corelib/Qt6AndroidMacros.cmake
@@ -262,9 +262,9 @@ function(qt6_android_generate_deployment_settings target)
endfunction()
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
- macro(qt_android_generate_deployment_settings)
+ function(qt_android_generate_deployment_settings)
qt6_android_generate_deployment_settings(${ARGV})
- endmacro()
+ endfunction()
endif()
function(qt6_android_apply_arch_suffix target)
@@ -277,9 +277,9 @@ function(qt6_android_apply_arch_suffix target)
endfunction()
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
- macro(qt_android_apply_arch_suffix)
+ function(qt_android_apply_arch_suffix)
qt6_android_apply_arch_suffix(${ARGV})
- endmacro()
+ endfunction()
endif()
# Add custom target to package the APK
@@ -397,7 +397,7 @@ function(_qt_internal_create_global_apk_all_target_if_needed)
endfunction()
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
- macro(qt_android_add_apk_target)
+ function(qt_android_add_apk_target)
qt6_android_add_apk_target(${ARGV})
- endmacro()
+ endfunction()
endif()
diff --git a/src/corelib/Qt6CoreMacros.cmake b/src/corelib/Qt6CoreMacros.cmake
index cff947d808..80d2d4cf4d 100644
--- a/src/corelib/Qt6CoreMacros.cmake
+++ b/src/corelib/Qt6CoreMacros.cmake
@@ -164,13 +164,13 @@ function(qt6_generate_moc infile outfile )
endfunction()
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
- macro(qt_generate_moc)
+ function(qt_generate_moc)
if(QT_DEFAULT_MAJOR_VERSION EQUAL 5)
qt5_generate_moc(${ARGV})
elseif(QT_DEFAULT_MAJOR_VERSION EQUAL 6)
qt6_generate_moc(${ARGV})
endif()
- endmacro()
+ endfunction()
endif()
@@ -203,13 +203,14 @@ endfunction()
# This will override the CMake upstream command, because that one is for Qt 3.
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
- macro(qt_wrap_cpp)
+ function(qt_wrap_cpp outfiles)
if(QT_DEFAULT_MAJOR_VERSION EQUAL 5)
- qt5_wrap_cpp(${ARGV})
+ qt5_wrap_cpp("${outfiles}" ${ARGN})
elseif(QT_DEFAULT_MAJOR_VERSION EQUAL 6)
- qt6_wrap_cpp(${ARGV})
+ qt6_wrap_cpp("${outfiles}" ${ARGN})
endif()
- endmacro()
+ set("${outfiles}" "${${outfiles}}" PARENT_SCOPE)
+ endfunction()
endif()
@@ -290,13 +291,13 @@ function(qt6_add_binary_resources target )
endfunction()
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
- macro(qt_add_binary_resources)
+ function(qt_add_binary_resources)
if(QT_DEFAULT_MAJOR_VERSION EQUAL 5)
qt5_add_binary_resources(${ARGV})
elseif(QT_DEFAULT_MAJOR_VERSION EQUAL 6)
qt6_add_binary_resources(${ARGV})
endif()
- endmacro()
+ endfunction()
endif()
@@ -348,13 +349,16 @@ function(qt6_add_resources outfiles )
endfunction()
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
- macro(qt_add_resources)
+ function(qt_add_resources outfiles)
if(QT_DEFAULT_MAJOR_VERSION EQUAL 5)
- qt5_add_resources(${ARGV})
+ qt5_add_resources("${outfiles}" ${ARGN})
elseif(QT_DEFAULT_MAJOR_VERSION EQUAL 6)
- qt6_add_resources(${ARGV})
+ qt6_add_resources("${outfiles}" ${ARGN})
endif()
- endmacro()
+ if(NOT TARGET ${outfiles})
+ set("${outfiles}" "${${outfiles}}" PARENT_SCOPE)
+ endif()
+ endfunction()
endif()
@@ -423,13 +427,14 @@ function(qt6_add_big_resources outfiles )
endfunction()
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
- macro(qt_add_big_resources)
+ function(qt_add_big_resources outfiles)
if(QT_DEFAULT_MAJOR_VERSION EQUAL 5)
- qt5_add_big_resources(${ARGV})
+ qt5_add_big_resources(${outfiles} ${ARGN})
elseif(QT_DEFAULT_MAJOR_VERSION EQUAL 6)
- qt6_add_big_resources(${ARGV})
+ qt6_add_big_resources(${outfiles} ${ARGN})
endif()
- endmacro()
+ set("${outfiles}" "${${outfiles}}" PARENT_SCOPE)
+ endfunction()
endif()
function(_qt_internal_apply_win_prefix_and_suffix target)
@@ -773,17 +778,17 @@ function(_qt_internal_finalize_ios_app target)
endfunction()
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
- macro(qt_add_executable)
+ function(qt_add_executable)
qt6_add_executable(${ARGV})
- endmacro()
- macro(qt_finalize_target)
+ endfunction()
+ function(qt_finalize_target)
qt6_finalize_target(${ARGV})
- endmacro()
+ endfunction()
# Kept for compatibility with Qt Creator 4.15 wizards
- macro(qt_finalize_executable)
+ function(qt_finalize_executable)
qt6_finalize_target(${ARGV})
- endmacro()
+ endfunction()
endif()
function(_qt_get_plugin_name_with_version target out_var)
@@ -893,13 +898,13 @@ function(qt6_import_plugins target)
endfunction()
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
- macro(qt_import_plugins)
+ function(qt_import_plugins)
if(QT_DEFAULT_MAJOR_VERSION EQUAL 5)
qt5_import_plugins(${ARGV})
elseif(QT_DEFAULT_MAJOR_VERSION EQUAL 6)
qt6_import_plugins(${ARGV})
endif()
- endmacro()
+ endfunction()
endif()
# This function is currently in Technical Preview. It's signature may change or be removed entirely.
@@ -946,9 +951,9 @@ function(qt6_set_finalizer_mode target)
endfunction()
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
- macro(qt_set_finalizer_mode)
+ function(qt_set_finalizer_mode)
qt6_set_finalizer_mode(${ARGV})
- endmacro()
+ endfunction()
endif()
# Extracts metatypes from a Qt target and generates a metatypes.json for it.
@@ -1227,9 +1232,9 @@ function(qt6_extract_metatypes target)
endfunction()
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
- macro(qt_extract_metatypes)
+ function(qt_extract_metatypes)
qt6_extract_metatypes(${ARGV})
- endmacro()
+ endfunction()
endif()
# Generate Win32 RC files for a target. All entries in the RC file are generated
@@ -1975,9 +1980,9 @@ function(qt6_add_plugin target)
endfunction()
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
- macro(qt_add_plugin)
+ function(qt_add_plugin)
qt6_add_plugin(${ARGV})
- endmacro()
+ endfunction()
endif()
# Creates a library by forwarding arguments to add_library, applies some Qt naming file name naming
@@ -2077,9 +2082,9 @@ function(_qt_internal_add_library target)
endfunction()
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
- macro(qt_add_library)
+ function(qt_add_library)
qt6_add_library(${ARGV})
- endmacro()
+ endfunction()
endif()
# By default Qt6 forces usage of utf8 sources for consumers of Qt.
@@ -2090,9 +2095,9 @@ function(qt6_allow_non_utf8_sources target)
endfunction()
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
- macro(qt_allow_non_utf8_sources)
+ function(qt_allow_non_utf8_sources)
qt6_allow_non_utf8_sources(${ARGV})
- endmacro()
+ endfunction()
endif()
function(_qt_internal_apply_strict_cpp target)
@@ -2190,7 +2195,7 @@ function(qt6_disable_unicode_defines target)
endfunction()
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
- macro(qt_disable_unicode_defines)
+ function(qt_disable_unicode_defines)
qt6_disable_unicode_defines(${ARGV})
- endmacro()
+ endfunction()
endif()
diff --git a/src/dbus/Qt6DBusMacros.cmake b/src/dbus/Qt6DBusMacros.cmake
index 4f5373437a..e4e8635dff 100644
--- a/src/dbus/Qt6DBusMacros.cmake
+++ b/src/dbus/Qt6DBusMacros.cmake
@@ -76,13 +76,14 @@ function(qt6_add_dbus_interface _sources _interface _basename)
endfunction()
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
- macro(qt_add_dbus_interface)
+ function(qt_add_dbus_interface sources)
if(QT_DEFAULT_MAJOR_VERSION EQUAL 5)
- qt5_add_dbus_interface(${ARGV})
+ qt5_add_dbus_interface("${sources}" ${ARGN})
elseif(QT_DEFAULT_MAJOR_VERSION EQUAL 6)
- qt6_add_dbus_interface(${ARGV})
+ qt6_add_dbus_interface("${sources}" ${ARGN})
endif()
- endmacro()
+ set("${sources}" "${${sources}}" PARENT_SCOPE)
+ endfunction()
endif()
@@ -99,13 +100,14 @@ function(qt6_add_dbus_interfaces _sources)
endfunction()
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
- macro(qt_add_dbus_interfaces)
+ function(qt_add_dbus_interfaces sources)
if(QT_DEFAULT_MAJOR_VERSION EQUAL 5)
- qt5_add_dbus_interfaces(${ARGV})
+ qt5_add_dbus_interfaces("${sources}" ${ARGN})
elseif(QT_DEFAULT_MAJOR_VERSION EQUAL 6)
- qt6_add_dbus_interfaces(${ARGV})
+ qt6_add_dbus_interfaces("${sources}" ${ARGN})
endif()
- endmacro()
+ set("${sources}" "${${sources}}" PARENT_SCOPE)
+ endfunction()
endif()
@@ -143,13 +145,13 @@ function(qt6_generate_dbus_interface _header) # _customName OPTIONS -some -optio
endfunction()
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
- macro(qt_generate_dbus_interface)
+ function(qt_generate_dbus_interface)
if(QT_DEFAULT_MAJOR_VERSION EQUAL 5)
qt5_generate_dbus_interface(${ARGV})
elseif(QT_DEFAULT_MAJOR_VERSION EQUAL 6)
qt6_generate_dbus_interface(${ARGV})
endif()
- endmacro()
+ endfunction()
endif()
@@ -201,11 +203,12 @@ function(qt6_add_dbus_adaptor _sources _xml_file _include) # _optionalParentClas
endfunction()
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
- macro(qt_add_dbus_adaptor)
+ function(qt_add_dbus_adaptor sources)
if(QT_DEFAULT_MAJOR_VERSION EQUAL 5)
- qt5_add_dbus_adaptor(${ARGV})
+ qt5_add_dbus_adaptor("${sources}" ${ARGN})
elseif(QT_DEFAULT_MAJOR_VERSION EQUAL 6)
- qt6_add_dbus_adaptor(${ARGV})
+ qt6_add_dbus_adaptor("${sources}" ${ARGN})
endif()
- endmacro()
+ set("${sources}" "${${sources}}" PARENT_SCOPE)
+ endfunction()
endif()
diff --git a/src/widgets/Qt6WidgetsMacros.cmake b/src/widgets/Qt6WidgetsMacros.cmake
index 615e3ee695..aa8133ba47 100644
--- a/src/widgets/Qt6WidgetsMacros.cmake
+++ b/src/widgets/Qt6WidgetsMacros.cmake
@@ -70,11 +70,12 @@ endfunction()
# This will override the CMake upstream command, because that one is for Qt 3.
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
- macro(qt_wrap_ui)
+ function(qt_wrap_ui outfiles)
if(QT_DEFAULT_MAJOR_VERSION EQUAL 5)
- qt5_wrap_ui(${ARGV})
+ qt5_wrap_ui("${outfiles}" ${ARGN})
elseif(QT_DEFAULT_MAJOR_VERSION EQUAL 6)
- qt6_wrap_ui(${ARGV})
+ qt6_wrap_ui("${outfiles}" ${ARGN})
endif()
- endmacro()
+ set("${outfiles}" "${${outfiles}}" PARENT_SCOPE)
+ endfunction()
endif()