Salome HOME
Copyrights update 2015.
[modules/yacs.git] / adm / cmake / FindPThread.cmake
1 # - Find PThread
2 # This module finds an installed PThread using the variable PTHREAD_ROOT_DIR 
3 # as a lookup path.
4 # It sets the following variables:
5 #  PTHREAD_FOUND       - set to true if PThread is found
6 #  PTHREAD_INCLUDE_DIR - the directory where the include files are located
7 #  PTHREAD_LIBRARIES   - the path to PThread library
8 #
9 # The file "pthread.h" is looked for PTHREAD_INCLUDE_DIR.
10 # Libraries are searched with following names: 
11 #    pthread
12 # On Win32:
13 #    pthreadVC2
14 # or in Debug mode:
15 #    pthreadVC2d
16 #
17
18
19 #############################################################
20 # Copyright (C) 2014-2015  CEA/DEN, EDF R&D
21 #
22 # This library is free software; you can redistribute it and/or
23 # modify it under the terms of the GNU Lesser General Public
24 # License as published by the Free Software Foundation; either
25 # version 2.1 of the License, or (at your option) any later version.
26 #
27 # This library is distributed in the hope that it will be useful,
28 # but WITHOUT ANY WARRANTY; without even the implied warranty of
29 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
30 # Lesser General Public License for more details.
31 #
32 # You should have received a copy of the GNU Lesser General Public
33 # License along with this library; if not, write to the Free Software
34 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
35 #
36 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
37 #
38
39 IF(NOT PThread_FIND_QUIETLY)
40     MESSAGE(STATUS "Looking for PThread...")
41 ENDIF ()
42
43 IF(WIN32)
44     SET(PTHREADS_INCLUDE_TO_FIND pthread.h)
45     FIND_PATH(PTHREAD_INCLUDE_DIR ${PTHREADS_INCLUDE_TO_FIND})
46     # Default build type is assumed to be Release:
47     IF(NOT CMAKE_BUILD_TYPE STREQUAL Debug)
48         FIND_LIBRARY(PTHREAD_LIBRARIES pthreadVC2)
49     ELSE()
50         FIND_LIBRARY(PTHREAD_LIBRARIES pthreadVC2d)
51     ENDIF()
52 ELSE(WIN32)
53     FIND_PATH(PTHREAD_INCLUDE_DIR pthread.h)
54     FIND_LIBRARY(PTHREAD_LIBRARIES NAMES pthread)
55 ENDIF(WIN32)
56
57 INCLUDE(FindPackageHandleStandardArgs)
58 FIND_PACKAGE_HANDLE_STANDARD_ARGS(PThread REQUIRED_VARS PTHREAD_INCLUDE_DIR PTHREAD_LIBRARIES)
59
60 IF(PTHREAD_FOUND)
61   IF(NOT PThread_FIND_QUIETLY)
62     MESSAGE(STATUS "PThread library: ${PTHREAD_LIBRARIES}")
63   ENDIF()
64 ENDIF()