Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake: Port PR30137 from the master branch #214

Merged
merged 1 commit into from
May 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()
Loading