Add appropriate MSVC version check for warnings are errors feature

In qmake land warnings_are_errors is only enabled for specific
MSVC versions, ending with MSVC2015. Presumably the warnings have not
yet been fixed for newer MSVC versions, so we stick with the same
status quo for now.

Change-Id: Idc3741d39c888f77ed324a5eb8c654416591785f
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
Alexandru Croitor 2019-06-11 11:40:26 +02:00
parent 449eee2d10
commit c09e770a5d

View File

@ -48,8 +48,12 @@ function(qt_internal_set_warnings_are_errors_flags target)
endif()
endif()
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
# using Visual Studio C++
target_compile_options("${target}" INTERFACE /WX)
# In qmake land, currently warnings as errors are only enabled for
# MSVC 2012, 2013, 2015.
# Respectively MSVC_VERRSIONs are: 1700-1799, 1800-1899, 1900-1909.
if(MSVC_VERSION GREATER_EQUAL 1700 AND MSVC_VERSION LESS_EQUAL 1909)
target_compile_options("${target}" INTERFACE /WX)
endif()
endif()
endfunction()