diff --git a/CMakeLists.txt b/CMakeLists.txt index 02849ca44..aaf9a8af9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -110,11 +110,18 @@ if(CMAKE_COMPILER_IS_GNUCXX) set(WARNING_FLAGS -Wall -Wextra - -Wshadow=local -Wimplicit-fallthrough=1 -Wno-unused-parameter -Wno-psabi ) + + if(NOT DEFINED WARNING_SHADOW_LOCAL) + option(WARNING_SHADOW_LOCAL "Show shadows declarations warning." ON) + endif() + + if(WARNING_SHADOW_LOCAL) + list(APPEND WARNING_FLAGS "-Wshadow=local") + endif() endif() if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")