Warn about missing override specifiers, if supported (gcc 5.1, clang 3.5)

This commit is contained in:
Simon Richter 2016-09-24 05:13:29 +02:00 committed by Wayne Stambaugh
parent 83c805e8fb
commit ff41c8f7cb
1 changed files with 12 additions and 0 deletions

View File

@ -174,6 +174,18 @@ if( CMAKE_VERSION VERSION_LESS 3.1 AND ( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_C
endif() endif()
# Warn about missing override specifiers, if supported
if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-Wsuggest-override" COMPILER_SUPPORTS_WSUGGEST_OVERRIDE)
if(COMPILER_SUPPORTS_WSUGGEST_OVERRIDE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsuggest-override")
endif()
endif()
#================================================ #================================================
# Set flags for GCC, or treat llvm as GCC # Set flags for GCC, or treat llvm as GCC
#================================================ #================================================