diff options
author | RonxBulld <526677628@qq.com> | 2021-04-21 11:17:30 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-21 11:17:30 +0300 |
commit | 174510285a451d5e2ab2c4054bc88ce8b4ba933d (patch) | |
tree | 7b03c579ef0e7ae5d313754c5bb17a2b0b8c5fa6 /cmake | |
parent | dd45a0801c99d62109aaa29f8c410ba8def2fbf2 (diff) |
-Wsuggest-override is not supported by gcc before 5.0 (#283)
* -Wsuggest-override is not supported by gcc before 5.0
* GCC prior to 5.0 should ignore not only -Wnon-virtual-dtor but also -Weffc++, otherwise non-virtual destructor problems will still be reported.
* The `#pragma GCC diagnostic push' should be used before setting up the temporary environment.
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/cxxopts.cmake | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/cmake/cxxopts.cmake b/cmake/cxxopts.cmake index 8f9d61a..e65c4b5 100644 --- a/cmake/cxxopts.cmake +++ b/cmake/cxxopts.cmake @@ -74,8 +74,10 @@ function(cxxopts_enable_warnings) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W2") elseif(CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU") if (CMAKE_CXX_COMPILER_ID MATCHES "GNU") + if (${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER_EQUAL 5.0) set(COMPILER_SPECIFIC_FLAGS "-Wsuggest-override") - endif() + endif() + endif() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -Wextra -Wshadow -Weffc++ -Wsign-compare -Wshadow -Wwrite-strings -Wpointer-arith -Winit-self -Wconversion -Wno-sign-conversion ${COMPILER_SPECIFIC_FLAGS}") endif() |