From 0ede1b5b22e32893f15345193a46ebca67b4a342 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Thu, 22 Mar 2018 13:18:45 +0300 Subject: [PATCH] cmake: enable override warnings (requires C++11 compilation mode) --- cmake/OpenCVCompilerOptions.cmake | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmake/OpenCVCompilerOptions.cmake b/cmake/OpenCVCompilerOptions.cmake index f4974b3cf5..ae22437e8a 100644 --- a/cmake/OpenCVCompilerOptions.cmake +++ b/cmake/OpenCVCompilerOptions.cmake @@ -103,6 +103,13 @@ if(CV_GCC OR CV_CLANG) add_extra_compiler_option(-Wsign-promo) add_extra_compiler_option(-Wuninitialized) add_extra_compiler_option(-Winit-self) + if(HAVE_CXX11) + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + add_extra_compiler_option(-Wsuggest-override) + elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + add_extra_compiler_option(-Winconsistent-missing-override) + endif() + endif() if(ENABLE_NOISY_WARNINGS) add_extra_compiler_option(-Wcast-align)