Skip to content

Commit

Permalink
Merge bitcoin/bitcoin#30803: build: Minor build system fixes and amen…
Browse files Browse the repository at this point in the history
…dments

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

Pull request description:

  This PR addresses the following comments:
  - bitcoin/bitcoin#30454 (comment)
  - bitcoin/bitcoin#30454 (comment)
  - bitcoin/bitcoin#30454 (comment)
  - bitcoin/bitcoin#30454 (comment)
  - bitcoin/bitcoin#30454 (comment)
  - bitcoin/bitcoin#30454 (comment)
  - bitcoin/bitcoin#30454 (comment)

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

Tree-SHA512: a390797bb4d3b7eb9163653b6c9c324e7a01090f6cdda74df7349a24a5c4a2084e5912878747f56561315afc70cae9adb1c363f47ceb0af96004ea591d25171b
  • Loading branch information
fanquake committed Sep 12, 2024
2 parents a86e7a4 + 1cc93fe commit db8350b
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 33 deletions.
12 changes: 4 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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)

Expand Down
3 changes: 2 additions & 1 deletion cmake/module/FlagsSummary.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
15 changes: 1 addition & 14 deletions cmake/module/TryAppendCXXFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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}")
Expand Down Expand Up @@ -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)
Expand Down
9 changes: 1 addition & 8 deletions cmake/module/TryAppendLinkerFlag.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion doc/build-windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit db8350b

Please sign in to comment.