Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CMake on Mac: Could NOT find Threads (missing: Threads_FOUND)

I'm trying to compile LibPD and I am receiving a CMake error message. I have scourged the net for solutions dealing with this problem on Mac, but have found none that are from the past 10 years. I am receiving this error on both my MacBook Pro and my Mac tower desktop. :

I type:

cmake .. -GXcode

I get:

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)

Thanks for the help.

like image 774
Nakul Tiruviluamala Avatar asked Feb 08 '19 06:02

Nakul Tiruviluamala


1 Answers

Although I did not get this error on mojave, one way to deal with threads on mac is to tell cmake threads are built in.

# 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()
like image 105
Richard Barber Avatar answered Nov 06 '22 08:11

Richard Barber