From 55951a6ca0939f6dd93a62fcf898d71bca824dc4 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 13 May 2022 10:12:58 +0200 Subject: [PATCH] MSVC: Disable bogus warning MSVC incorrectly warns when using a static method in a lambda that has non-static overloads, and not capturing 'this' in the lambda. That wouldn't be a big issue if other compilers wouldn't then warn about 'this' being captured and not used. Simply disable the warning. Change-Id: I40b96c4758f7468c1e6f3577119123e0c7abf241 Reviewed-by: Orgad Shaneh Reviewed-by: David Schulz --- CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index a4195eb781b..aba83469bed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,6 +57,14 @@ if (WITH_TESTS) set(IMPLICIT_DEPENDS Qt5::Test) endif() +# suppress bogus warning +# warning C4573 requires the compiler to capture 'this' but the current default capture mode does not allow it +# when using QObject::connect in lambda without capturing 'this' - which would lead to warnings +# with other compilers +if(MSVC) + add_compile_options(/wd4573) +endif() + find_package(Qt5 ${IDE_QT_VERSION_MIN} COMPONENTS Concurrent Core Gui Network PrintSupport Qml Sql Widgets Xml Core5Compat ${QT_TEST_COMPONENT}