Skip to content

FindThreads: Consolidate pthread checks

Brad King requested to merge brad.king/cmake:FindThreads-cleanup into master

Checks for variants of pthreads added over time were looking at different things: presence of the header, presence of a library, or presence of enough symbols in libc. Consolidate them all to try a complete test program that includes the header and references symbols.

Also perform some cleanup and simplification. See individual commit messages for details.

Some changes might be incompatible with projects not using the documented interfaces:

  • Drop the undocumented CMAKE_HAVE_PTHREAD_H check, as it is no longer needed.
  • Drop the unused internal CMAKE_HAVE_THREADS_LIBRARY variable.

These can later be restored for compatibility if necessary.

Issue: #23430

Merge request reports