Merge bitcoin/bitcoin#30803: build: Minor build system fixes and amendments

1cc93fe7b4 build: Delete dead code that implements `IF_CHECK_FAILED` option (Hennadii Stepanov)
341ad23809 build: Delete MSVC special case for `BUILD_FOR_FUZZING` option (Hennadii Stepanov)
fdad128b52 build: Stop enabling CMake's CMP0141 policy (Hennadii Stepanov)
b2a6f545b4 doc: Drop `ctest` command from Windows cross-compiling instructions (Hennadii Stepanov)
73b618582d build: Print `CMAKE_CXX_COMPILER_ARG1` in summary (Hennadii Stepanov)
f03c942095 build, test: Add missed log options (Hennadii Stepanov)
6f2cb0eafd doc: Amend comment about ZeroMQ config files (Hennadii Stepanov)

Pull request description:

  This PR addresses the following comments:
  - https://github.com/bitcoin/bitcoin/pull/30454#discussion_r1742342524
  - https://github.com/bitcoin/bitcoin/pull/30454#discussion_r1728692369
  - https://github.com/bitcoin/bitcoin/pull/30454#discussion_r1736110362
  - https://github.com/bitcoin/bitcoin/pull/30454#discussion_r1742931121
  - https://github.com/bitcoin/bitcoin/pull/30454#discussion_r1747723657
  - https://github.com/bitcoin/bitcoin/pull/30454#discussion_r1742328675
  - https://github.com/bitcoin/bitcoin/pull/30454#discussion_r1723106474

ACKs for top commit:
  sipsorcery:
    tACK 1cc93fe7b4 (win11 msvc).
  maflcko:
    re-ACK 1cc93fe7b4

Tree-SHA512: a390797bb4d3b7eb9163653b6c9c324e7a01090f6cdda74df7349a24a5c4a2084e5912878747f56561315afc70cae9adb1c363f47ceb0af96004ea591d25171b
pull/30865/head
merge-script 2 months ago
commit db8350b0e3
No known key found for this signature in database
GPG Key ID: 2EEB9F5CC09526C1

@ -8,12 +8,6 @@
# Centos Stream 9, https://www.centos.org/cl-vs-cs/#end-of-life, EOL in May 2027:
# - CMake 3.26.5, https://mirror.stream.centos.org/9-stream/AppStream/x86_64/os/Packages/
cmake_minimum_required(VERSION 3.22)
if(POLICY CMP0141)
# MSVC debug information format flags are selected by an abstraction.
# We want to use the CMAKE_MSVC_DEBUG_INFORMATION_FORMAT variable
# to select the MSVC debug information format.
cmake_policy(SET CMP0141 NEW)
endif()
if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "In-source builds are not allowed.")
@ -143,7 +137,9 @@ if(WITH_ZMQ)
find_package(ZeroMQ CONFIG REQUIRED)
else()
# The ZeroMQ project has provided config files since v4.2.2.
# TODO: Switch to find_package(ZeroMQ) at some point in the future.
# However, mainstream distributions do not yet provide CMake
# config files for ZeroMQ packages. If they do in the future,
# find_package(ZeroMQ) may be used instead.
find_package(PkgConfig REQUIRED)
pkg_check_modules(libzmq REQUIRED IMPORTED_TARGET libzmq>=4)
endif()
@ -194,7 +190,7 @@ endif()
option(BUILD_BENCH "Build bench_bitcoin executable." OFF)
option(BUILD_FUZZ_BINARY "Build fuzz binary." OFF)
cmake_dependent_option(BUILD_FOR_FUZZING "Build for fuzzing. Enabling this will disable all other targets and override BUILD_FUZZ_BINARY." OFF "NOT MSVC" OFF)
option(BUILD_FOR_FUZZING "Build for fuzzing. Enabling this will disable all other targets and override BUILD_FUZZ_BINARY." OFF)
option(INSTALL_MAN "Install man pages." ON)

@ -22,7 +22,8 @@ function(print_flags_per_config config indent_num)
get_target_interface(definitions "${config}" core_interface COMPILE_DEFINITIONS)
indent_message("Preprocessor defined macros ..........." "${definitions}" ${indent_num})
string(STRIP "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${config_uppercase}}" combined_cxx_flags)
string(STRIP "${CMAKE_CXX_COMPILER_ARG1} ${CMAKE_CXX_FLAGS}" combined_cxx_flags)
string(STRIP "${combined_cxx_flags} ${CMAKE_CXX_FLAGS_${config_uppercase}}" combined_cxx_flags)
string(STRIP "${combined_cxx_flags} ${CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION}" combined_cxx_flags)
if(CMAKE_POSITION_INDEPENDENT_CODE)
string(JOIN " " combined_cxx_flags ${combined_cxx_flags} ${CMAKE_CXX_COMPILE_OPTIONS_PIC})

@ -32,12 +32,6 @@ Usage examples:
)
try_append_cxx_flags("-Werror=return-type" TARGET core_interface
IF_CHECK_FAILED "-Wno-error=return-type"
SOURCE "#include <cassert>\nint f(){ assert(false); }"
)
In configuration output, this function prints a string by the following pattern:
-- Performing Test CXX_SUPPORTS_[flags]
@ -49,7 +43,7 @@ function(try_append_cxx_flags flags)
TACXXF # prefix
"SKIP_LINK" # options
"TARGET;VAR;SOURCE;RESULT_VAR" # one_value_keywords
"IF_CHECK_PASSED;IF_CHECK_FAILED" # multi_value_keywords
"IF_CHECK_PASSED" # multi_value_keywords
)
set(flags_as_string "${flags}")
@ -88,13 +82,6 @@ function(try_append_cxx_flags flags)
string(STRIP "${${TACXXF_VAR}} ${flags_as_string}" ${TACXXF_VAR})
endif()
endif()
elseif(DEFINED TACXXF_IF_CHECK_FAILED)
if(DEFINED TACXXF_TARGET)
target_compile_options(${TACXXF_TARGET} INTERFACE ${TACXXF_IF_CHECK_FAILED})
endif()
if(DEFINED TACXXF_VAR)
string(STRIP "${${TACXXF_VAR}} ${TACXXF_IF_CHECK_FAILED}" ${TACXXF_VAR})
endif()
endif()
if(DEFINED TACXXF_VAR)

@ -22,7 +22,7 @@ function(try_append_linker_flag flag)
TALF # prefix
"" # options
"TARGET;VAR;SOURCE;RESULT_VAR" # one_value_keywords
"IF_CHECK_PASSED;IF_CHECK_FAILED" # multi_value_keywords
"IF_CHECK_PASSED" # multi_value_keywords
)
string(MAKE_C_IDENTIFIER "${flag}" result)
@ -58,13 +58,6 @@ function(try_append_linker_flag flag)
string(STRIP "${${TALF_VAR}} ${flag}" ${TALF_VAR})
endif()
endif()
elseif(DEFINED TALF_IF_CHECK_FAILED)
if(DEFINED TALF_TARGET)
target_link_options(${TALF_TARGET} INTERFACE ${TACXXF_IF_CHECK_FAILED})
endif()
if(DEFINED TALF_VAR)
string(STRIP "${${TALF_VAR}} ${TACXXF_IF_CHECK_FAILED}" ${TALF_VAR})
endif()
endif()
if(DEFINED TALF_VAR)

@ -67,7 +67,6 @@ Build using:
gmake -C depends HOST=x86_64-w64-mingw32 # Use "-j N" for N parallel jobs.
cmake -B build --toolchain depends/x86_64-w64-mingw32/toolchain.cmake
cmake --build build # Use "-j N" for N parallel jobs.
ctest --test-dir build # Use "-j N" for N parallel tests. Some tests are disabled if Python 3 is not available.
## Depends system

@ -196,7 +196,7 @@ function(add_boost_test source_file)
)
if(test_suite_name)
add_test(NAME ${test_suite_name}
COMMAND test_bitcoin --run_test=${test_suite_name} --catch_system_error=no
COMMAND test_bitcoin --run_test=${test_suite_name} --catch_system_error=no --log_level=test_suite -- DEBUG_LOG_OUT
)
set_property(TEST ${test_suite_name} PROPERTY
SKIP_REGULAR_EXPRESSION "no test cases matching filter" "Skipping"

Loading…
Cancel
Save