From f26e8886b377757d862fd8db79715bbb0cb8740e Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 29 May 2024 10:20:46 -0400 Subject: [PATCH] cmake-gui: Suppress MSVC deprecation warnings from Qt headers MSVC 14.38+ toolsets deprecate `stdext::checked_array_iterator`. Support building with versions of Qt that have not been updated to avoid the deprecated API. Qt-Issue: https://bugreports.qt.io/browse/QTBUG-118993 --- Source/QtDialog/CMakeLists.txt | 5 +++++ Tests/CMakeGUI/CMakeLists.txt | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index e6e41ec4e9..e4b53fd2e7 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -48,6 +48,11 @@ if(WIN32) endif() endif() +if(MSVC) + # QTBUG-118993: Qt uses deprecated stdext::checked_array_iterator + add_compile_definitions(_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING) +endif() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt${INSTALLED_QT_VERSION}Widgets_EXECUTABLE_COMPILE_FLAGS}") if(CMake_QT_STATIC_QXcbIntegrationPlugin_LIBRARIES) diff --git a/Tests/CMakeGUI/CMakeLists.txt b/Tests/CMakeGUI/CMakeLists.txt index 4e8609b854..c9f44e960c 100644 --- a/Tests/CMakeGUI/CMakeLists.txt +++ b/Tests/CMakeGUI/CMakeLists.txt @@ -2,6 +2,11 @@ include(CMakeParseArguments) find_package(Qt5Test REQUIRED) +if(MSVC) + # QTBUG-118993: Qt uses deprecated stdext::checked_array_iterator + add_compile_definitions(_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING) +endif() + include_directories( ${CMake_SOURCE_DIR}/Source ${CMake_SOURCE_DIR}/Source/QtDialog