mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-10 03:47:29 -03:00
cmake: Add WERROR
option
This commit is contained in:
parent
c98d4a4c34
commit
30f642952c
1 changed files with 15 additions and 0 deletions
|
@ -106,6 +106,7 @@ cmake_dependent_option(BUILD_WALLET_TOOL "Build bitcoin-wallet tool." ${BUILD_TE
|
|||
|
||||
option(ENABLE_HARDENING "Attempt to harden the resulting executables." ON)
|
||||
option(REDUCE_EXPORTS "Attempt to reduce exported symbols in the resulting executables." OFF)
|
||||
option(WERROR "Treat compiler warnings as errors." OFF)
|
||||
option(WITH_CCACHE "Attempt to use ccache for compiling." ON)
|
||||
|
||||
option(WITH_NATPMP "Enable NAT-PMP." OFF)
|
||||
|
@ -412,6 +413,19 @@ if(REDUCE_EXPORTS)
|
|||
try_append_linker_flag("-Wl,-no_exported_symbols" VAR CMAKE_EXE_LINKER_FLAGS)
|
||||
endif()
|
||||
|
||||
if(WERROR)
|
||||
if(MSVC)
|
||||
set(werror_flag "/WX")
|
||||
else()
|
||||
set(werror_flag "-Werror")
|
||||
endif()
|
||||
try_append_cxx_flags(${werror_flag} TARGET core_interface SKIP_LINK RESULT_VAR compiler_supports_werror)
|
||||
if(NOT compiler_supports_werror)
|
||||
message(FATAL_ERROR "WERROR set but ${werror_flag} is not usable.")
|
||||
endif()
|
||||
unset(werror_flag)
|
||||
endif()
|
||||
|
||||
find_package(Python3 3.9 COMPONENTS Interpreter)
|
||||
if(Python3_EXECUTABLE)
|
||||
set(PYTHON_COMMAND ${Python3_EXECUTABLE})
|
||||
|
@ -471,6 +485,7 @@ message("C++ compiler .......................... ${CMAKE_CXX_COMPILER_ID} ${CMAK
|
|||
include(FlagsSummary)
|
||||
flags_summary()
|
||||
message("Attempt to harden executables ......... ${ENABLE_HARDENING}")
|
||||
message("Treat compiler warnings as errors ..... ${WERROR}")
|
||||
message("Use ccache for compiling .............. ${WITH_CCACHE}")
|
||||
message("\n")
|
||||
if(configure_warnings)
|
||||
|
|
Loading…
Reference in a new issue