]> SALOME platform Git repositories - tools/libbatch.git/commitdiff
Salome HOME
Changed PThread detection macro for Windows
authorbarate <barate>
Wed, 15 Jun 2011 09:11:42 +0000 (09:11 +0000)
committerbarate <barate>
Wed, 15 Jun 2011 09:11:42 +0000 (09:11 +0000)
CMakeModules/FindPThread.cmake

index 43150446a629a7d2f529817aefa1422daf98979e..690fdfcdfc35c2b01d5ec4ee609fb9e90e52b12c 100644 (file)
@@ -24,8 +24,25 @@ IF (NOT PThread_FIND_QUIETLY)
     MESSAGE(STATUS "Looking for PThread...")
 ENDIF (NOT PThread_FIND_QUIETLY)
 
-FIND_PATH(PTHREAD_INCLUDE_DIR pthread.h)
-FIND_LIBRARY(PTHREAD_LIBRARY NAMES pthread pthreadVC2) 
+IF(WIN32)
+    SET(PTHREADS_ROOT_USER $ENV{PTHREADS_ROOT})
+    SET(PTHREADS_FIND_PATHS_OPTION NO_DEFAULT_PATH)
+    SET(PTHREADS_INCLUDE_TO_FIND pthread.h)
+    SET(PTHREADS_INCLUDE_PATHS ${PTHREADS_ROOT_USER}/include)
+    FIND_PATH(PTHREAD_INCLUDE_DIR ${PTHREADS_INCLUDE_TO_FIND}
+              PATHS ${PTHREADS_INCLUDE_PATHS} ${PTHREADS_FIND_PATHS_OPTION})
+    SET(PTHREADS_LIB_PATHS ${PTHREADS_ROOT_USER}/lib)
+    IF(CMAKE_BUILD_TYPE STREQUAL Release)
+        FIND_LIBRARY(PTHREAD_LIBRARY pthreadVSE2 pthreadVC2
+                     PATHS ${PTHREADS_LIB_PATHS} ${PTHREADS_FIND_PATHS_OPTION})
+    ELSE(CMAKE_BUILD_TYPE STREQUAL Release)
+        FIND_LIBRARY(PTHREAD_LIBRARY pthreadVSE2d pthreadVC2d
+                     PATHS ${PTHREADS_LIB_PATHS} ${PTHREADS_FIND_PATHS_OPTION})
+    ENDIF(CMAKE_BUILD_TYPE STREQUAL Release)
+ELSE(WIN32)
+    FIND_PATH(PTHREAD_INCLUDE_DIR pthread.h)
+    FIND_LIBRARY(PTHREAD_LIBRARY NAMES pthread)
+ENDIF(WIN32)
 
 IF (PTHREAD_INCLUDE_DIR AND PTHREAD_LIBRARY)
     SET(PThread_FOUND True)