Skip to content

Commit

Permalink
Merge #214: cmake: Port PR30137 from the master branch
Browse files Browse the repository at this point in the history
af7c6ed fixup! cmake: Build `bitcoin_util` static library (Hennadii Stepanov)

Pull request description:

  This PR ports bitcoin#30137.

  The `target_compile_definitions` command is to be deleted during the next sync/rebase round. Such an early porting is needed for #93 in order to delete the only non-config related generator expression from the compile definitions, which simplifies the summary code a lot.

  Effectively, this commit has been split from #93.

Top commit has no ACKs.

Tree-SHA512: 0062abb77fea3c1f6800452a0a0c9bff39cc357b09e3f2a0e25eaa9961faad515b493dd3f6f217edcb5d43830cd16d953b99ae52c02a3a2fe56fc911dcf79154
  • Loading branch information
hebasto committed May 25, 2024
2 parents 06872ef + af7c6ed commit 6230d47
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 22 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ if(WITH_BDB)
endif()
cmake_dependent_option(BUILD_WALLET_TOOL "Build bitcoin-wallet tool." ${BUILD_TESTS} "ENABLE_WALLET" OFF)

option(ENABLE_THREADLOCAL "Enable features that depend on the C++ thread_local keyword (currently just thread names in debug logs)." ON)
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)
Expand Down
22 changes: 1 addition & 21 deletions cmake/module/AddThreadsIfNeeded.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,5 @@ function(add_threads_if_needed)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
set_target_properties(Threads::Threads PROPERTIES IMPORTED_GLOBAL TRUE)

if(MINGW)
#[=[
mingw32's implementation of thread_local has been shown to behave
erroneously under concurrent usage.
See:
- https://github.com/bitcoin/bitcoin/pull/15849
- https://gist.github.com/jamesob/fe9a872051a88b2025b1aa37bfa98605
]=]
elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
#[=[
FreeBSD's implementation of thread_local is buggy.
See:
- https://github.com/bitcoin/bitcoin/pull/16059
- https://groups.google.com/d/msg/bsdmailinglist/22ncTZAbDp4/Dii_pII5AwAJ
]=]
elseif(ENABLE_THREADLOCAL)
target_compile_definitions(core_interface INTERFACE
"$<$<COMPILE_FEATURES:cxx_thread_local>:HAVE_THREAD_LOCAL>"
)
endif()
target_compile_definitions(core_interface INTERFACE HAVE_THREAD_LOCAL)
endfunction()

0 comments on commit 6230d47

Please sign in to comment.