mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-02-09 02:59:31 +08:00
build: replace WERROR with CMAKE_COMPILE_WARNING_AS_ERROR
-Werror is added to the previous releases job, given it runs on Ubuntu 22.04, which uses an older CMake. `--compile-no-warning-as-error` can be used, if needed, in future, to suppress the `CMAKE_COMPILE_WARNING_AS_ERROR` behaviour from a CI config. CMAKE_COMPILE_WARNING_AS_ERROR was added to CMake in 3.24. See https://cmake.org/cmake/help/latest/prop_tgt/COMPILE_WARNING_AS_ERROR.html. Co-authored-by: willcl-ark <will8clark@gmail.com>
This commit is contained in:
@@ -119,7 +119,6 @@ endif()
|
||||
cmake_dependent_option(BUILD_WALLET_TOOL "Build bitcoin-wallet tool." ${BUILD_TESTS} "ENABLE_WALLET" OFF)
|
||||
|
||||
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_ZMQ "Enable ZMQ notifications." OFF)
|
||||
@@ -568,19 +567,6 @@ 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()
|
||||
|
||||
# Prefer Unix-style package components over frameworks on macOS.
|
||||
# This improves compatibility with Python version managers.
|
||||
set(Python3_FIND_FRAMEWORK LAST CACHE STRING "")
|
||||
@@ -685,7 +671,7 @@ message("Cross compiling ....................... ${cross_status}")
|
||||
message("C++ compiler .......................... ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}, ${CMAKE_CXX_COMPILER}")
|
||||
include(FlagsSummary)
|
||||
flags_summary()
|
||||
message("Treat compiler warnings as errors ..... ${WERROR}")
|
||||
message("Treat compiler warnings as errors ..... ${CMAKE_COMPILE_WARNING_AS_ERROR}")
|
||||
message("Use ccache for compiling .............. ${WITH_CCACHE}")
|
||||
message("\n")
|
||||
if(configure_warnings)
|
||||
|
||||
Reference in New Issue
Block a user