Skip to content

Commit

Permalink
PROTON-2810: Always link thread support into C++ code
Browse files Browse the repository at this point in the history
Avoiding linking thread support for C++ was a bit premature and breaks
builds on a few important systems so revert that part of the change.
  • Loading branch information
astitcher committed Jul 5, 2024
1 parent 5498087 commit 637c7c5
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@ endif()
include(CMakeDependentOption)
enable_language(CXX)

# This is only needed for FreeBSD with clang (its system compiler)
# Everything else will get threads support by default with C++ libs
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
find_package(Threads)
link_libraries(Threads::Threads)
endif()
# This is not needed for modern versions of Linux using glibc 2.34 or later
# However RHEL before RHEL 9; Ubuntu before 22.04; Debian before 12 and FreeBSD
# with clang (its system compiler) all still need to link the threads library
# explicitly even though thread support is now included in C++17.
#
# So leave this here for a few more years!
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
find_package(Threads)
link_libraries(Threads::Threads)

include(versions.cmake)

Expand Down

0 comments on commit 637c7c5

Please sign in to comment.