-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads CMake Error at /usr/share/cmake/Modules/CheckLibraryExists.cmake:41 (try_compile): Only libraries may be used as try_compile IMPORTED LINK_LIBRARIES. Got pthreads of type EXECUTABLE. Call Stack (most recent call first): /usr/share/cmake/Modules/FindThreads.cmake:58 (CHECK_LIBRARY_EXISTS) tests/app_suite/CMakeLists.txt:58 (find_package)
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
I'm on fedora 18 64-bit.
find_package(Threads REQUIRED)
target_link_libraries(app_suite_tests ${CMAKE_THREAD_LIBS_INIT})
is the code that is creating this. What can I do to prevent CMake from throwing an error here, or how can I get CMake to check the pthreads library over the executable?
Thanks.
Additonal Info:
if(NOT CMAKE_HAVE_THREADS_LIBRARY)
# Do we have -lpthreads
CHECK_LIBRARY_EXISTS(pthreads pthread_create "" CMAKE_HAVE_PTHREADS_CREATE)
if(CMAKE_HAVE_PTHREADS_CREATE)
set(CMAKE_THREAD_LIBS_INIT "-lpthreads")
set(CMAKE_HAVE_THREADS_LIBRARY 1)
set(Threads_FOUND TRUE)
endif()
Is from FindThreads.cmake, and the error is thrown on CHECK_LIBRARY_EXISTS