cmake和libpthread [英] cmake and libpthread
本文介绍了cmake和libpthread的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在运行 RHEL 5.1
并使用 gcc
。
如何通过 cmake
添加 -pthread
进行编译和链接?
How I tell cmake
to add -pthread
to compilation and linking?
推荐答案
以下应该是干净的(使用 find_package
)和工作c $ c> FindThreads ):
The following should be clean (using find_package
) and work (the find module is called FindThreads
):
cmake_minimum_required (VERSION 2.6)
find_package (Threads)
add_executable (myapp main.cpp ...)
target_link_libraries (myapp ${CMAKE_THREAD_LIBS_INIT})
这篇关于cmake和libpthread的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文