From fb0e905e242c2044fd25683a406eb6d369db052f Mon Sep 17 00:00:00 2001 From: Allen Winter Date: Wed, 19 Feb 2020 18:04:24 -0500 Subject: [PATCH] CMakeLists.txt - allow compilers without -Wsuggest-override test for the -Wsuggest-override compiler option --- CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 36a59872f..addbafe2b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -110,11 +110,11 @@ if(MSVC) add_definitions(-D_SCL_SECURE_NO_WARNINGS) endif() -if(CMAKE_COMPILER_IS_GNUCXX) - if(CMAKE_VERSION VERSION_LESS "3.0") +if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") + include(CheckCXXCompilerFlag) + check_cxx_compiler_flag(-Wsuggest-override HAVE_GXX_SUGGEST_OVERRIDE) + if(HAVE_GXX_SUGGEST_OVERRIDE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsuggest-override") - else() - add_compile_options(-Wsuggest-override) endif() endif()