Skip to content

Commit 3975da4

Browse files
authored
cmake: SILKWORM_ALLOW_UNUSED_VAR_WARNINGS build option (#2052)
1 parent b520fba commit 3975da4

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ option(SILKWORM_CLANG_TIDY "Clang-Tidy linter" OFF)
5555
option(SILKWORM_SANITIZE "Build instrumentation for sanitizers" OFF)
5656
option(SILKWORM_FUZZER "Build instrumentation for fuzzers" OFF)
5757
option(SILKWORM_USE_MIMALLOC "Enable using mimalloc for dynamic memory management" ON)
58+
option(SILKWORM_ALLOW_UNUSED_VAR_WARNINGS "Turn unused variable errors into warnings" OFF)
5859

5960
if(NOT SILKWORM_HAS_PARENT)
6061
include(cmake/conan.cmake)

cmake/compiler_warnings.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ elseif((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MAT
3333
add_compile_options(-Wtype-limits -Wformat=2)
3434
add_compile_options(-Wno-missing-field-initializers)
3535

36+
if(SILKWORM_ALLOW_UNUSED_VAR_WARNINGS)
37+
add_compile_options(-Wno-error=unused-parameter)
38+
add_compile_options(-Wno-error=unused-variable)
39+
endif()
40+
3641
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
3742
add_compile_options(-Wduplicated-cond -Wduplicated-branches -Wlogical-op)
3843
add_compile_options(-Wno-attributes)

0 commit comments

Comments
 (0)