Skip to content

Commit d37c9a2

Browse files
committed
[FIXUP] cmake: Ensure C language is disabled for FindThreads
Must be squashed with the commit d028a49 "cmake: Build `bitcoin_util` static library".
1 parent 3bb3448 commit d37c9a2

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

cmake/module/AddThreadsIfNeeded.cmake

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,17 @@ function(add_threads_if_needed)
77
# require Threads. Therefore, a proper check will be
88
# appropriate here.
99

10+
if(CMAKE_C_COMPILER_LOADED)
11+
message(FATAL_ERROR [=[
12+
To make FindThreads check C++ language features, C language must be
13+
disabled. This is essential, at least, when cross-compiling for MinGW-w64
14+
because two different threading models are available.
15+
]=] )
16+
endif()
17+
1018
set(THREADS_PREFER_PTHREAD_FLAG ON)
1119
find_package(Threads REQUIRED)
20+
set_target_properties(Threads::Threads PROPERTIES IMPORTED_GLOBAL TRUE)
1221

1322
set(thread_local)
1423
if(MINGW)

0 commit comments

Comments
 (0)