GCC 4.6.0
Linux
cmake 2.8
我使用cmake生成我的make文件cmake的find_package包。但是,在我的network_imp.c
文件中,我需要执行一些线程。所以我已经包含头文件#include <pthread.h>
和我正在使用pthread_create()
函数发现使用
如何告诉cmake使用此头pthread.h和共享库-lpthread?
我想过使用find_package,但我认为我没有正确使用它。这是我的CMakeLists.txt文件。
find_package(pthread)
add_library(network SHARED network_imp.c)
我得到当我尝试做的错误是这样的:
undefined reference to pthread_create
非常感谢您的任何建议,
[cmake和libpthread]可能的重复(http://stackoverflow.com/questions/1620918/cmake-and-libpthread) – mpromonet 2015-01-26 22:01:25