[llvm] [cmake] Add pthread to required libraries before dl and rt checks (PR #203054)
Reid Kleckner via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 10 12:18:31 PDT 2026
================
@@ -160,8 +155,22 @@ if(HAVE_LIBPTHREAD)
set(THREADS_HAVE_PTHREAD_ARG Off)
find_package(Threads REQUIRED)
set(LLVM_PTHREAD_LIB ${CMAKE_THREAD_LIBS_INIT})
+ if(LLVM_PTHREAD_LIB)
+ list(APPEND CMAKE_REQUIRED_LIBRARIES ${LLVM_PTHREAD_LIB})
+ endif()
+endif()
+
+# Keep the dlopen and rt library checks after FindThreads so that
+# CMAKE_REQUIRED_LIBRARIES includes pthread. glibc versions before 2.34 may
+# need pthread to satisfy librt dependencies.
+if(NOT WIN32)
+ check_library_exists(dl dlopen "" HAVE_LIBDL)
+ check_library_exists(rt shm_open "" HAVE_LIBRT)
endif()
+# Check for libpfm.
+include(FindLibpfm)
----------------
rnk wrote:
I think it makes sense, the idea here was to move all the pthread detection code into one block, instead of having a long block of unrelated library detection checks.
https://github.com/llvm/llvm-project/pull/203054
More information about the llvm-commits
mailing list