diff options
author | albert-github <albert.tests@gmail.com> | 2020-05-11 10:53:45 (GMT) |
---|---|---|
committer | albert-github <albert.tests@gmail.com> | 2020-05-11 10:53:45 (GMT) |
commit | 751c3c104eeb89613f07b74002585d70c012af97 (patch) | |
tree | 56d3cccaa531ac434e1719517bb49131ecef6e39 | |
parent | 37037eab8c26578df0ff866727f2357948762ca2 (diff) | |
download | Doxygen-751c3c104eeb89613f07b74002585d70c012af97.zip Doxygen-751c3c104eeb89613f07b74002585d70c012af97.tar.gz Doxygen-751c3c104eeb89613f07b74002585d70c012af97.tar.bz2 |
GNU compilation warnings
Older GNU compilers, i.e. before version 7, don't know the option `-Wno-implicit-fallthrough`, so it is made compiler version dependent.
(would have liked to use `VERSION_GREATER_EQUAL` but this is introduced in cmake 3.7)
-rw-r--r-- | cmake/CompilerWarnings.cmake | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/cmake/CompilerWarnings.cmake b/cmake/CompilerWarnings.cmake index 41ee545..e6c1539 100644 --- a/cmake/CompilerWarnings.cmake +++ b/cmake/CompilerWarnings.cmake @@ -93,7 +93,6 @@ function(set_project_warnings project_name) -Wno-unused-parameter -Wno-sign-conversion -Wno-format-nonliteral - -Wno-implicit-fallthrough # enable to turn warnings into errors #-Werror @@ -104,7 +103,15 @@ function(set_project_warnings project_name) elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") set(PROJECT_WARNINGS ${CLANG_WARNINGS}) else() - set(PROJECT_WARNINGS ${GCC_WARNINGS}) + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "7.0.0") + set(GCC_EXTRA_WARNINGS + -Wno-implicit-fallthrough + ) + else() + set(GCC_EXTRA_WARNINGS + ) + endif() + set(PROJECT_WARNINGS ${GCC_WARNINGS} ${GCC_EXTRA_WARNINGS}) endif() target_compile_options(${project_name} PRIVATE ${PROJECT_WARNINGS}) |