What does “Performing Test CMAKE_HAVE_LIBC_PTHREAD” failed actually mean?

The lines

-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found

are output of a call like

find_package(Threads)

This call is used in a script CMakeLists.txt by many CMake projects which want to use threads-related functionality (like pthread_create).

When process this call, CMake (by means of FindThreads.cmake script) tries to determine kind of thread support for the current platform.

The check Looking for pthread.h is self-explanatory: CMake checks whether header pthread.h exists and available.

The check Performing Test CMAKE_HAVE_LIBC_PTHREAD is about whether thread support functions are compiled into libc library directly, or one need to link additional libraries (like -lpthread).

The check Looking for pthread_create in pthreads tries to find pthreads library and function pthread_create in it.

The check Looking for pthread_create in pthread tries to find pthread library and function pthread_create in it.


That particular output could be interpreted as:

The platform supports threads by providing the header pthread.h and the library pthread.

This output is common for Unix-like systems.
Despite “Failed” and “not found” words, this is perfectly good output.

Leave a Comment