Skip to content

Commit

Permalink
fixup! cmake: Build bitcoin_util static library
Browse files Browse the repository at this point in the history
Port PR30137.

The `target_compile_definitions` command is to be deleted during the
next sync/rebase round.
  • Loading branch information
hebasto committed May 25, 2024
1 parent 06872ef commit af7c6ed
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 af7c6ed

Please sign in to comment.