From c09e770a5d3932e8d3cd91d97f75fcb7e7cceebd Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Tue, 11 Jun 2019 11:40:26 +0200 Subject: [PATCH] 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 --- cmake/QtInternalTargets.cmake | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmake/QtInternalTargets.cmake b/cmake/QtInternalTargets.cmake index 083be94ab47..f289326de08 100644 --- a/cmake/QtInternalTargets.cmake +++ b/cmake/QtInternalTargets.cmake @@ -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()