BUG: fix for 6586, set THREADS_FOUND

This commit is contained in:
Bill Hoffman 2008-09-11 11:41:00 -04:00
parent 7e5222165d
commit 0e5319f21d
1 changed files with 12 additions and 0 deletions

View File

@ -8,6 +8,7 @@
INCLUDE (CheckIncludeFiles) INCLUDE (CheckIncludeFiles)
INCLUDE (CheckLibraryExists) INCLUDE (CheckLibraryExists)
SET(Threads_FOUND FALSE)
# Do we have sproc? # Do we have sproc?
IF(CMAKE_SYSTEM MATCHES IRIX) IF(CMAKE_SYSTEM MATCHES IRIX)
@ -30,11 +31,13 @@ ELSE(CMAKE_HAVE_SPROC_H)
IF(CMAKE_HAVE_PTHREADS_CREATE) IF(CMAKE_HAVE_PTHREADS_CREATE)
SET(CMAKE_THREAD_LIBS_INIT "-lpthreads") SET(CMAKE_THREAD_LIBS_INIT "-lpthreads")
SET(CMAKE_HAVE_THREADS_LIBRARY 1) SET(CMAKE_HAVE_THREADS_LIBRARY 1)
SET(Threads_FOUND TRUE)
ENDIF(CMAKE_HAVE_PTHREADS_CREATE) ENDIF(CMAKE_HAVE_PTHREADS_CREATE)
# Ok, how about -lpthread # Ok, how about -lpthread
CHECK_LIBRARY_EXISTS(pthread pthread_create "" CMAKE_HAVE_PTHREAD_CREATE) CHECK_LIBRARY_EXISTS(pthread pthread_create "" CMAKE_HAVE_PTHREAD_CREATE)
IF(CMAKE_HAVE_PTHREAD_CREATE) IF(CMAKE_HAVE_PTHREAD_CREATE)
SET(CMAKE_THREAD_LIBS_INIT "-lpthread") SET(CMAKE_THREAD_LIBS_INIT "-lpthread")
SET(Threads_FOUND TRUE)
SET(CMAKE_HAVE_THREADS_LIBRARY 1) SET(CMAKE_HAVE_THREADS_LIBRARY 1)
ENDIF(CMAKE_HAVE_PTHREAD_CREATE) ENDIF(CMAKE_HAVE_PTHREAD_CREATE)
IF(CMAKE_SYSTEM MATCHES "SunOS.*") IF(CMAKE_SYSTEM MATCHES "SunOS.*")
@ -43,6 +46,7 @@ ELSE(CMAKE_HAVE_SPROC_H)
IF(CMAKE_HAVE_THR_CREATE) IF(CMAKE_HAVE_THR_CREATE)
SET(CMAKE_THREAD_LIBS_INIT "-lthread") SET(CMAKE_THREAD_LIBS_INIT "-lthread")
SET(CMAKE_HAVE_THREADS_LIBRARY 1) SET(CMAKE_HAVE_THREADS_LIBRARY 1)
SET(Threads_FOUND TRUE)
ENDIF(CMAKE_HAVE_THR_CREATE) ENDIF(CMAKE_HAVE_THR_CREATE)
ENDIF(CMAKE_SYSTEM MATCHES "SunOS.*") ENDIF(CMAKE_SYSTEM MATCHES "SunOS.*")
ENDIF(NOT THREADS_HAVE_PTHREAD_ARG) ENDIF(NOT THREADS_HAVE_PTHREAD_ARG)
@ -58,6 +62,7 @@ ELSE(CMAKE_HAVE_SPROC_H)
COMPILE_OUTPUT_VARIABLE OUTPUT) COMPILE_OUTPUT_VARIABLE OUTPUT)
IF(THREADS_HAVE_PTHREAD_ARG) IF(THREADS_HAVE_PTHREAD_ARG)
IF(THREADS_PTHREAD_ARG MATCHES "^2$") IF(THREADS_PTHREAD_ARG MATCHES "^2$")
SET(Threads_FOUND TRUE)
MESSAGE(STATUS "Check if compiler accepts -pthread - yes") MESSAGE(STATUS "Check if compiler accepts -pthread - yes")
ELSE(THREADS_PTHREAD_ARG MATCHES "^2$") ELSE(THREADS_PTHREAD_ARG MATCHES "^2$")
MESSAGE(STATUS "Check if compiler accepts -pthread - no") MESSAGE(STATUS "Check if compiler accepts -pthread - no")
@ -73,6 +78,7 @@ ELSE(CMAKE_HAVE_SPROC_H)
ENDIF(THREADS_HAVE_PTHREAD_ARG) ENDIF(THREADS_HAVE_PTHREAD_ARG)
ENDIF("THREADS_HAVE_PTHREAD_ARG" MATCHES "^THREADS_HAVE_PTHREAD_ARG") ENDIF("THREADS_HAVE_PTHREAD_ARG" MATCHES "^THREADS_HAVE_PTHREAD_ARG")
IF(THREADS_HAVE_PTHREAD_ARG) IF(THREADS_HAVE_PTHREAD_ARG)
SET(Threads_FOUND TRUE)
SET(CMAKE_THREAD_LIBS_INIT "-pthread") SET(CMAKE_THREAD_LIBS_INIT "-pthread")
ENDIF(THREADS_HAVE_PTHREAD_ARG) ENDIF(THREADS_HAVE_PTHREAD_ARG)
ENDIF(NOT CMAKE_HAVE_THREADS_LIBRARY) ENDIF(NOT CMAKE_HAVE_THREADS_LIBRARY)
@ -81,10 +87,12 @@ ENDIF(CMAKE_HAVE_SPROC_H)
IF(CMAKE_THREAD_LIBS_INIT) IF(CMAKE_THREAD_LIBS_INIT)
SET(CMAKE_USE_PTHREADS_INIT 1) SET(CMAKE_USE_PTHREADS_INIT 1)
SET(Threads_FOUND TRUE)
ENDIF(CMAKE_THREAD_LIBS_INIT) ENDIF(CMAKE_THREAD_LIBS_INIT)
IF(CMAKE_SYSTEM MATCHES "Windows") IF(CMAKE_SYSTEM MATCHES "Windows")
SET(CMAKE_USE_WIN32_THREADS_INIT 1) SET(CMAKE_USE_WIN32_THREADS_INIT 1)
SET(Threads_FOUND TRUE)
ENDIF(CMAKE_SYSTEM MATCHES "Windows") ENDIF(CMAKE_SYSTEM MATCHES "Windows")
IF(CMAKE_USE_PTHREADS_INIT) IF(CMAKE_USE_PTHREADS_INIT)
@ -101,6 +109,7 @@ IF(CMAKE_USE_PTHREADS_INIT)
IF(CMAKE_HAVE_HP_CMA) IF(CMAKE_HAVE_HP_CMA)
SET(CMAKE_THREAD_LIBS_INIT "-lcma") SET(CMAKE_THREAD_LIBS_INIT "-lcma")
SET(CMAKE_HP_PTHREADS_INIT 1) SET(CMAKE_HP_PTHREADS_INIT 1)
SET(Threads_FOUND TRUE)
ENDIF(CMAKE_HAVE_HP_CMA) ENDIF(CMAKE_HAVE_HP_CMA)
SET(CMAKE_USE_PTHREADS_INIT 1) SET(CMAKE_USE_PTHREADS_INIT 1)
ENDIF(CMAKE_SYSTEM MATCHES "HP-UX-*") ENDIF(CMAKE_SYSTEM MATCHES "HP-UX-*")
@ -112,8 +121,11 @@ IF(CMAKE_USE_PTHREADS_INIT)
IF(CMAKE_SYSTEM MATCHES "CYGWIN_NT*") IF(CMAKE_SYSTEM MATCHES "CYGWIN_NT*")
SET(CMAKE_USE_PTHREADS_INIT 1) SET(CMAKE_USE_PTHREADS_INIT 1)
SET(Threads_FOUND TRUE)
SET(CMAKE_THREAD_LIBS_INIT ) SET(CMAKE_THREAD_LIBS_INIT )
SET(CMAKE_USE_WIN32_THREADS_INIT 0) SET(CMAKE_USE_WIN32_THREADS_INIT 0)
ENDIF(CMAKE_SYSTEM MATCHES "CYGWIN_NT*") ENDIF(CMAKE_SYSTEM MATCHES "CYGWIN_NT*")
ENDIF(CMAKE_USE_PTHREADS_INIT) ENDIF(CMAKE_USE_PTHREADS_INIT)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Threads DEFAULT_MSG Threads_FOUND)