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 <orgads@gmail.com>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Eike Ziller
2022-05-13 10:12:58 +02:00
parent f29c53b4f6
commit 55951a6ca0

View File

@@ -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}