diff --git a/cmake/OpenCVCompilerOptions.cmake b/cmake/OpenCVCompilerOptions.cmake index 22c33806d1..e52bea0a31 100644 --- a/cmake/OpenCVCompilerOptions.cmake +++ b/cmake/OpenCVCompilerOptions.cmake @@ -103,7 +103,9 @@ if(CV_GCC OR CV_CLANG) add_extra_compiler_option(-Wundef) add_extra_compiler_option(-Winit-self) add_extra_compiler_option(-Wpointer-arith) - add_extra_compiler_option(-Wshadow) + if(NOT (CV_GCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.0")) + add_extra_compiler_option(-Wshadow) # old GCC emits warnings for variables + methods combination + endif() add_extra_compiler_option(-Wsign-promo) add_extra_compiler_option(-Wuninitialized) add_extra_compiler_option(-Winit-self)