Skip to content

Commit

Permalink
[FIXUP] cmake: Ensure C language is disabled for FindThreads
Browse files Browse the repository at this point in the history
Must be squashed with the commit d028a49
"cmake: Build `bitcoin_util` static library".
  • Loading branch information
hebasto committed Mar 24, 2023
1 parent 3bb3448 commit d37c9a2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cmake/module/AddThreadsIfNeeded.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,17 @@ function(add_threads_if_needed)
# require Threads. Therefore, a proper check will be
# appropriate here.

if(CMAKE_C_COMPILER_LOADED)
message(FATAL_ERROR [=[
To make FindThreads check C++ language features, C language must be
disabled. This is essential, at least, when cross-compiling for MinGW-w64
because two different threading models are available.
]=] )
endif()

set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
set_target_properties(Threads::Threads PROPERTIES IMPORTED_GLOBAL TRUE)

set(thread_local)
if(MINGW)
Expand Down

0 comments on commit d37c9a2

Please sign in to comment.