From ff5bc9266a39dc1d63ca02f592089bd4c2d9c4f6 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Wed, 16 Oct 2024 11:29:09 +0200 Subject: [PATCH] CMake: Fix deprecation level regex It should allow a through f for hex digits as well. Pick-to: 6.8 Fixes: QTBUG-130119 Change-Id: I79a13d4e5dfee5c4c229eb64c26a5530928d0495 Reviewed-by: Alexey Edelev --- src/corelib/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/corelib/CMakeLists.txt b/src/corelib/CMakeLists.txt index 1bfd5a22014..2355c7eb9cd 100644 --- a/src/corelib/CMakeLists.txt +++ b/src/corelib/CMakeLists.txt @@ -1557,6 +1557,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, @@ -1566,7 +1568,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 "Invalid format of the QT_DISABLE_DEPRECATED_UP_TO macro:" " ${QT_DISABLE_DEPRECATED_UP_TO}. The expected format is the hexadecimal number," " e.g. 0x060102")