This is an automated email from the ASF dual-hosted git repository.
astitcher pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git
The following commit(s) were added to refs/heads/main by this push:
new 637c7c585 PROTON-2810: Always link thread support into C++ code
637c7c585 is described below
commit 637c7c58520143f0937734faded0a9f647fe5875
Author: Andrew Stitcher <[email protected]>
AuthorDate: Fri Jul 5 16:13:37 2024 -0400
PROTON-2810: Always link thread support into C++ code
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.
---
cpp/CMakeLists.txt | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index 106415bca..93b42424e 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -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)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]