10

我正在尝试编译 LibPD,但收到一条 CMake 错误消息。我在网上搜寻了解决 Mac 上这个问题的解决方案,但没有找到过去 10 年的解决方案。我在我的 MacBook Pro 和我的 Mac 塔式桌面上都收到此错误。:

我输入:

cmake .. -GXcode

我得到:

CMake Error at /Applications/CMake.app/Contents/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find Threads (missing: Threads_FOUND)
Call Stack (most recent call first):
  /Applications/CMake.app/Contents/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
  /Applications/CMake.app/Contents/share/cmake-3.13/Modules/FindThreads.cmake:205 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:317 (find_package)

谢谢您的帮助。

4

1 回答 1

19

尽管我在 mojave 上没有收到此错误,但在 mac 上处理线程的一种方法是告诉 cmake 线程是内置的。

# assume built-in pthreads on MacOS
IF(APPLE)
    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)
ENDIF()
于 2019-02-09T13:18:42.057 回答