From 26fbaada0a4d3b9d1013cd5515c9e0dc413d0a2a Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Thu, 8 Dec 2016 18:02:57 +0300 Subject: [PATCH] cmake: disable warning C4127 for MSVS < 2015 --- cmake/OpenCVCompilerOptions.cmake | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cmake/OpenCVCompilerOptions.cmake b/cmake/OpenCVCompilerOptions.cmake index 57d142eb0b..06992c2de0 100644 --- a/cmake/OpenCVCompilerOptions.cmake +++ b/cmake/OpenCVCompilerOptions.cmake @@ -341,8 +341,13 @@ if(MSVC) string(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") string(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") - if(NOT ENABLE_NOISY_WARNINGS AND MSVC_VERSION EQUAL 1400) - ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4510 /wd4610 /wd4312 /wd4201 /wd4244 /wd4328 /wd4267) + if(NOT ENABLE_NOISY_WARNINGS) + if(MSVC_VERSION EQUAL 1400) + ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4510 /wd4610 /wd4312 /wd4201 /wd4244 /wd4328 /wd4267) + endif() + if(MSVC_VERSION LESS 1900) # MSVS2015 + ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4127) # warning C4127: conditional expression is constant + endif() endif() # allow extern "C" functions throw exceptions