File: FindPthreadsWin32.cmake

package info (click to toggle)
pocl 6.0-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 25,320 kB
  • sloc: lisp: 149,513; ansic: 103,778; cpp: 54,947; python: 1,513; sh: 949; ruby: 255; pascal: 226; tcl: 180; makefile: 175; java: 72; xml: 49
file content (67 lines) | stat: -rw-r--r-- 1,425 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#.rst:
# FindPthreadsWin32 library
# -------------------------
#
# Try to find pthreads libraries.
# https://sourceware.org/pthreads-win32/
#
# You may declare PTHREADS_ROOT environment variable to tell where
# your library is installed. 
#
# Once done this will define::
#
#   Pthreads_FOUND          - True if pthreads was found
#   Pthreads_INCLUDE_DIRS   - include directories for pthreads
#   Pthreads_LIBRARIES      - link against this library to use pthreads
#
# The module will also define two cache variables::
#
#   Pthreads_INCLUDE_DIR    - the pthreads include directory
#   Pthreads_LIBRARY        - the path to the pthreads library
#

find_path(Pthreads_INCLUDE_DIR
  NAMES
    pthread.h
  PATHS
    ENV "PROGRAMFILES(X86)"
    ENV PTHREADS_ROOT
  PATH_SUFFIXES
    include
)

if(CMAKE_SIZEOF_VOID_P EQUAL 8)
  set(LIB_PATH lib/x64)
else()
  set(LIB_PATH lib/x86)
endif()

find_library(Pthreads_LIBRARY
  NAMES 
    pthread.lib
    pthreadVC2.lib
    pthreadVC2.lib
  PATHS
    ENV PTHREADS_ROOT
  PATH_SUFFIXES
    ${LIB_PATH}
)

#
# All good
#

set(Pthreads_LIBRARIES ${Pthreads_LIBRARY})
set(Pthreads_INCLUDE_DIRS ${Pthreads_INCLUDE_DIR})

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
  Pthreads
  FOUND_VAR Pthreads_FOUND
  REQUIRED_VARS Pthreads_LIBRARY Pthreads_INCLUDE_DIR
  VERSION_VAR Pthreads_VERSION_STRING)

mark_as_advanced(
  Pthreads_INCLUDE_DIR
  Pthreads_LIBRARY)