From 0e5319f21dc6a6079a8af82e40ca3e9da563b6de Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Thu, 11 Sep 2008 11:41:00 -0400 Subject: [PATCH] BUG: fix for 6586, set THREADS_FOUND --- Modules/FindThreads.cmake | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake index 98031e2d0..6facb5155 100644 --- a/Modules/FindThreads.cmake +++ b/Modules/FindThreads.cmake @@ -8,6 +8,7 @@ INCLUDE (CheckIncludeFiles) INCLUDE (CheckLibraryExists) +SET(Threads_FOUND FALSE) # Do we have sproc? IF(CMAKE_SYSTEM MATCHES IRIX) @@ -30,11 +31,13 @@ ELSE(CMAKE_HAVE_SPROC_H) IF(CMAKE_HAVE_PTHREADS_CREATE) SET(CMAKE_THREAD_LIBS_INIT "-lpthreads") SET(CMAKE_HAVE_THREADS_LIBRARY 1) + SET(Threads_FOUND TRUE) ENDIF(CMAKE_HAVE_PTHREADS_CREATE) # Ok, how about -lpthread CHECK_LIBRARY_EXISTS(pthread pthread_create "" CMAKE_HAVE_PTHREAD_CREATE) IF(CMAKE_HAVE_PTHREAD_CREATE) SET(CMAKE_THREAD_LIBS_INIT "-lpthread") + SET(Threads_FOUND TRUE) SET(CMAKE_HAVE_THREADS_LIBRARY 1) ENDIF(CMAKE_HAVE_PTHREAD_CREATE) IF(CMAKE_SYSTEM MATCHES "SunOS.*") @@ -43,6 +46,7 @@ ELSE(CMAKE_HAVE_SPROC_H) IF(CMAKE_HAVE_THR_CREATE) SET(CMAKE_THREAD_LIBS_INIT "-lthread") SET(CMAKE_HAVE_THREADS_LIBRARY 1) + SET(Threads_FOUND TRUE) ENDIF(CMAKE_HAVE_THR_CREATE) ENDIF(CMAKE_SYSTEM MATCHES "SunOS.*") ENDIF(NOT THREADS_HAVE_PTHREAD_ARG) @@ -58,6 +62,7 @@ ELSE(CMAKE_HAVE_SPROC_H) COMPILE_OUTPUT_VARIABLE OUTPUT) IF(THREADS_HAVE_PTHREAD_ARG) IF(THREADS_PTHREAD_ARG MATCHES "^2$") + SET(Threads_FOUND TRUE) MESSAGE(STATUS "Check if compiler accepts -pthread - yes") ELSE(THREADS_PTHREAD_ARG MATCHES "^2$") 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" MATCHES "^THREADS_HAVE_PTHREAD_ARG") IF(THREADS_HAVE_PTHREAD_ARG) + SET(Threads_FOUND TRUE) SET(CMAKE_THREAD_LIBS_INIT "-pthread") ENDIF(THREADS_HAVE_PTHREAD_ARG) ENDIF(NOT CMAKE_HAVE_THREADS_LIBRARY) @@ -81,10 +87,12 @@ ENDIF(CMAKE_HAVE_SPROC_H) IF(CMAKE_THREAD_LIBS_INIT) SET(CMAKE_USE_PTHREADS_INIT 1) + SET(Threads_FOUND TRUE) ENDIF(CMAKE_THREAD_LIBS_INIT) IF(CMAKE_SYSTEM MATCHES "Windows") SET(CMAKE_USE_WIN32_THREADS_INIT 1) + SET(Threads_FOUND TRUE) ENDIF(CMAKE_SYSTEM MATCHES "Windows") IF(CMAKE_USE_PTHREADS_INIT) @@ -101,6 +109,7 @@ IF(CMAKE_USE_PTHREADS_INIT) IF(CMAKE_HAVE_HP_CMA) SET(CMAKE_THREAD_LIBS_INIT "-lcma") SET(CMAKE_HP_PTHREADS_INIT 1) + SET(Threads_FOUND TRUE) ENDIF(CMAKE_HAVE_HP_CMA) SET(CMAKE_USE_PTHREADS_INIT 1) ENDIF(CMAKE_SYSTEM MATCHES "HP-UX-*") @@ -112,8 +121,11 @@ IF(CMAKE_USE_PTHREADS_INIT) IF(CMAKE_SYSTEM MATCHES "CYGWIN_NT*") SET(CMAKE_USE_PTHREADS_INIT 1) + SET(Threads_FOUND TRUE) SET(CMAKE_THREAD_LIBS_INIT ) SET(CMAKE_USE_WIN32_THREADS_INIT 0) ENDIF(CMAKE_SYSTEM MATCHES "CYGWIN_NT*") ENDIF(CMAKE_USE_PTHREADS_INIT) +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Threads DEFAULT_MSG Threads_FOUND)