在编译项目的时候,遇到了下面的问题:
-- Looking for pthread.h - not found
CMake Error at /usr/local/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find Threads (missing: Threads_FOUND)
Call Stack (most recent call first):
/usr/local/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
/usr/local/share/cmake-3.10/Modules/FindThreads.cmake:205 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
src/lib/third_party/glfw/CMakeLists.txt:70 (find_package)
-- Configuring incomplete, errors occurred!
See also "/home/ec2-user/libraries/geogram/build/Linux64-gcc-dynamic-Release/CMakeFiles/CMakeOutput.log".
See also "/home/ec2-user/libraries/geogram/build/Linux64-gcc-dynamic-Release/CMakeFiles/CMakeError.log".
在CMakeLists.txt最上面添加如下语句:
set(CMAKE_THREAD_LIBS_INIT "-lpthread")
set(CMAKE_HAVE_THREADS_LIBRARY 1)
set(CMAKE_USE_WIN32_THREADS_INIT 0)
set(CMAKE_USE_PTHREADS_INIT 1)
set(THREADS_PREFER_PTHREAD_FLAG ON)
重新编译,即可编译通过。