CMake: Fix deprecation level regex

It should allow a through f for hex digits as well.

Fixes: QTBUG-130119
Change-Id: I79a13d4e5dfee5c4c229eb64c26a5530928d0495
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit ff5bc9266a39dc1d63ca02f592089bd4c2d9c4f6)
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Alexandru Croitor 2024-10-16 11:29:09 +02:00
parent 351b5b3e94
commit 1ca3e4d04f

View File

@ -1531,6 +1531,8 @@ function(qt_internal_library_deprecation_level)
# QT_DISABLE_DEPRECATED_UP_TO controls which version we use as a cut-off
# compiling in to the library. E.g. if it is set to QT_VERSION then no
# code which was deprecated before QT_VERSION will be compiled in.
set(digit "[0-9a-fA-F]")
string(REPEAT "${digit}" 6 six_digits)
if(NOT DEFINED QT_DISABLE_DEPRECATED_UP_TO)
if(WIN32)
# On Windows, due to the way DLLs work, we need to export all functions,
@ -1540,7 +1542,7 @@ function(qt_internal_library_deprecation_level)
# On other platforms, Qt's own compilation does need to compile the Qt 5.0 API
set(QT_DISABLE_DEPRECATED_UP_TO "0x050000")
endif()
elseif(NOT QT_DISABLE_DEPRECATED_UP_TO MATCHES "^0x[0-9][0-9][0-9][0-9][0-9][0-9]$")
elseif(NOT QT_DISABLE_DEPRECATED_UP_TO MATCHES "^0x${six_digits}$")
message(FATAL_ERROR "Ivalid format of the QT_DISABLE_DEPRECATED_UP_TO macro:"
" ${QT_DISABLE_DEPRECATED_UP_TO}. The expected format is the hexadecimal number,"
" e.g. 0x060102")