[PATCH] D122932: [cmake] avoid use of undocumented FindThread module variable
Carlo Marcelo Arenas Belón via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 1 12:49:25 PDT 2022
carenas created this revision.
Herald added subscribers: luke957, luismarques, s.egerton, PkmX, simoncook, arichardson, mgorny.
Herald added a project: All.
carenas requested review of this revision.
Herald added subscribers: llvm-commits, pcwang-thead.
Herald added a project: LLVM.
df7103ddc555 ([build] Make sure to link main executable with pthreads,
2016-06-21) add a reference to an internal variable that was meant to
ensure the returned flag would be a library name.
Change the variable name to the documented[1] one and that was made
available since release of cmake 3.1.
After this change; switching its value to "true" and removing the TODO
should be possible when using newer cmake, and indeed seems to work
fine under limited testing, but that change has been punted until a
need arises (ex: RISCV with gcc failing to link because of missing
libatomic) since it could also be problematic (ex: older clang warning
when it is used while linking)
[1] https://cmake.org/cmake/help/latest/module/FindThreads.html#variable:THREADS_PREFER_PTHREAD_FLAG
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D122932
Files:
llvm/cmake/config-ix.cmake
Index: llvm/cmake/config-ix.cmake
===================================================================
--- llvm/cmake/config-ix.cmake
+++ llvm/cmake/config-ix.cmake
@@ -111,7 +111,7 @@
# have it reported as '-l<lib>' instead of '-pthread'.
# TODO: switch to -pthread once the rest of the build system can deal with it.
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
- set(THREADS_HAVE_PTHREAD_ARG Off)
+ set(THREADS_PREFER_PTHREAD_FLAG FALSE)
find_package(Threads REQUIRED)
set(LLVM_PTHREAD_LIB ${CMAKE_THREAD_LIBS_INIT})
endif()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122932.419836.patch
Type: text/x-patch
Size: 538 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220401/49cbcec7/attachment.bin>
More information about the llvm-commits
mailing list