From a9634db561f5c2ad0cc488dabeb2b434e6bc7543 Mon Sep 17 00:00:00 2001 From: Sebastian Beckmann Date: Sun, 31 Aug 2025 13:36:16 +0200 Subject: [PATCH] frontend/cmake: Enable Qt strict mode Qt strict mode disables APIs deemed "'suboptimal' or 'dangerous'" [1] and "clearly undesirable" [2] by Qt that will be removed in the long term. Usages of the APIs in OBS have been removed in the previous commits, and by setting this flag we keep ourselves from using them again. The versioning works in a way where e.g. a new addition to this in 6.9 would only be disabled if at least 0x060900 is set. By setting 0xFF0000, we're effectively disabling any APIs that are deemed to be bad in any future Qt version (up to 255). While this could lead to OBS not being buildable against bleeding edge Qt, it also means that it will be noticed early. Should the disabled API turn out to be too complex to remove, the value can be downgraded to the last working one then. [1] qt/qtbase@3a6c8e02b6d1b0574da52b0087092d0c74aa92c1 [2] qt/qtbase@f9163ae7a8167daded0798654d99a2e3a5aaa2b5 --- frontend/cmake/ui-qt.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/frontend/cmake/ui-qt.cmake b/frontend/cmake/ui-qt.cmake index 4995cb5fa..f730b86d6 100644 --- a/frontend/cmake/ui-qt.cmake +++ b/frontend/cmake/ui-qt.cmake @@ -18,6 +18,9 @@ set_target_properties( PROPERTIES AUTOMOC TRUE AUTOUIC TRUE AUTORCC TRUE AUTOGEN_PARALLEL AUTO ) +# https://doc.qt.io/qt-6/qtglobal.html#QT_ENABLE_STRICT_MODE_UP_TO +target_compile_definitions(obs-studio PRIVATE QT_ENABLE_STRICT_MODE_UP_TO=0xFF0000) + set_property(TARGET obs-studio APPEND PROPERTY AUTOUIC_SEARCH_PATHS forms forms/source-toolbar) target_sources(