What does “Performing Test CMAKE_HAVE_LIBC_PTHREAD” failed actually mean?

情到浓时终转凉″ 提交于 2021-01-21 04:49:08

问题


The cmake partial output looks like this:

-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed

回答1:


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.



来源:https://stackoverflow.com/questions/64514666/what-does-performing-test-cmake-have-libc-pthread-failed-actually-mean

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!