diff options
author | Craig Scott <craig.scott@qt.io> | 2021-08-31 17:33:34 +1000 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2021-09-01 14:33:39 +0200 |
commit | ac50054c16382d76edf6e715fcaeb051ea0c68d1 (patch) | |
tree | 2b00c6487dd73db3c8d8c03807ed9012aa340e1e | |
parent | ced329f209311144d710a80fb548f595a01e816c (diff) |
Ensure versionless wrappers do not introduce a new variable scope
Using function instead of macro prevented the wrappers from being able
to pass back any variables set by the wrapped function in the calling
scope. Those specific cases were fixed in a separate commit, but this
change applies the pattern using macros uniformly across all the
versionless commands.
Task-number: QTBUG-96121
Task-number: QTBUG-96096
Change-Id: Ibc5fdbc81fcfbde8082a6d46388a068469b32f9c
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit bda9db56895a8d707638e7e2e4b06c96f59b99c2)
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
-rw-r--r-- | src/linguist/Qt6LinguistToolsMacros.cmake | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/src/linguist/Qt6LinguistToolsMacros.cmake b/src/linguist/Qt6LinguistToolsMacros.cmake index 449472e8a..97230b1be 100644 --- a/src/linguist/Qt6LinguistToolsMacros.cmake +++ b/src/linguist/Qt6LinguistToolsMacros.cmake @@ -101,18 +101,6 @@ function(qt6_create_translation _qm_files) set(${_qm_files} ${${_qm_files}} PARENT_SCOPE) endfunction() -if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS) - function(qt_create_translation _qm_files) - if(QT_DEFAULT_MAJOR_VERSION EQUAL 5) - qt5_create_translation("${_qm_files}" ${ARGN}) - elseif(QT_DEFAULT_MAJOR_VERSION EQUAL 6) - qt6_create_translation("${_qm_files}" ${ARGN}) - endif() - set("${_qm_files}" "${${_qm_files}}" PARENT_SCOPE) - endfunction() -endif() - - function(qt6_add_translation _qm_files) set(options) set(oneValueArgs) @@ -333,31 +321,37 @@ function(qt6_add_translations target) endfunction() if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS) - function(qt_add_translation _qm_files) + macro(qt_create_translation) if(QT_DEFAULT_MAJOR_VERSION EQUAL 5) - qt5_add_translation("${_qm_files}" ${ARGN}) + qt5_create_translation(${ARGV}) elseif(QT_DEFAULT_MAJOR_VERSION EQUAL 6) - qt6_add_translation("${_qm_files}" ${ARGN}) + qt6_create_translation(${ARGV}) endif() - set("${_qm_files}" "${${_qm_files}}" PARENT_SCOPE) - endfunction() - function(qt_add_lupdate) + endmacro() + macro(qt_add_translation) + if(QT_DEFAULT_MAJOR_VERSION EQUAL 5) + qt5_add_translation(${ARGV}) + elseif(QT_DEFAULT_MAJOR_VERSION EQUAL 6) + qt6_add_translation(${ARGV}) + endif() + endmacro() + macro(qt_add_lupdate) if(QT_DEFAULT_MAJOR_VERSION EQUAL 6) - qt6_add_lupdate(${ARGN}) + qt6_add_lupdate(${ARGV}) else() message(FATAL_ERROR "qt_add_lupdate() is only available in Qt 6.") endif() - endfunction() + endmacro() macro(qt_add_lrelease) if(QT_DEFAULT_MAJOR_VERSION EQUAL 6) - qt6_add_lrelease(${ARGN}) + qt6_add_lrelease(${ARGV}) else() message(FATAL_ERROR "qt_add_lrelease() is only available in Qt 6.") endif() endmacro() macro(qt_add_translations) if(QT_DEFAULT_MAJOR_VERSION EQUAL 6) - qt6_add_translations(${ARGN}) + qt6_add_translations(${ARGV}) else() message(FATAL_ERROR "qt_add_translations() is only available in Qt 6.") endif() |