Salome HOME
Copyright update 2021
[tools/configuration.git] / 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) 2007-2021  CEA/DEN, EDF R&D, OPEN CASCADE
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     FIND_LIBRARY(PTHREAD_LIBRARIES NAMES pthreadVC2 pthreadVC2d)
47 ELSE(WIN32)
48     FIND_PATH(PTHREAD_INCLUDE_DIR pthread.h)
49     FIND_LIBRARY(PTHREAD_LIBRARIES NAMES pthread)
50 ENDIF(WIN32)
51
52 INCLUDE(FindPackageHandleStandardArgs)
53 FIND_PACKAGE_HANDLE_STANDARD_ARGS(PThread REQUIRED_VARS PTHREAD_INCLUDE_DIR PTHREAD_LIBRARIES)
54
55 IF(PTHREAD_FOUND)
56   IF(NOT PThread_FIND_QUIETLY)
57     MESSAGE(STATUS "PThread library: ${PTHREAD_LIBRARIES}")
58   ENDIF()
59 ENDIF()