什么是“执行测试 CMAKE_HAVE_LIBC_PTHREAD"?失败实际上是什么意思? [英] What does "Performing Test CMAKE_HAVE_LIBC_PTHREAD" failed actually mean?
问题描述
cmake 部分输出如下所示:
-- 执行测试 CMAKE_HAVE_LIBC_PTHREAD-- 执行测试 CMAKE_HAVE_LIBC_PTHREAD - 失败
线条
-- 寻找 pthread.h-- 寻找 pthread.h - 找到-- 执行测试 CMAKE_HAVE_LIBC_PTHREAD-- 执行测试 CMAKE_HAVE_LIBC_PTHREAD - 失败-- 在 pthreads 中寻找 pthread_create-- 在 pthreads 中寻找 pthread_create - 未找到-- 在 pthread 中寻找 pthread_create-- 在 pthread 中寻找 pthread_create - 找到
是像
这样的调用的输出find_package(线程)
该调用在脚本 CMakeLists.txt
中被许多想要使用线程相关功能(如 pthread_create
)的 CMake 项目使用.
当处理这个调用时,CMake(通过FindThreads.cmake 脚本)尝试确定当前平台的线程支持种类.
检查Looking for pthread.h
是不言自明的:CMake 检查头文件pthread.h
是否存在和可用.
检查Performing Test CMAKE_HAVE_LIBC_PTHREAD
是关于线程支持函数是直接编译进libc库,还是需要链接额外的库(如-lpthread
).>
检查Looking for pthread_create in pthreads
尝试在其中找到pthreads
库和函数pthread_create
.
检查Looking for pthread_create in pthread
尝试在其中找到pthread
库和函数pthread_create
.
该特定输出可以解释为:
<块引用>平台通过提供头文件pthread.h
和库pthread
来支持线程.
这个输出在类 Unix 系统中很常见.尽管失败"和未找到"换句话说,这是非常好的输出.
The cmake partial output looks like this:
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
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 librarypthread
.
This output is common for Unix-like systems. Despite "Failed" and "not found" words, this is perfectly good output.
这篇关于什么是“执行测试 CMAKE_HAVE_LIBC_PTHREAD"?失败实际上是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!