File: FindPthread.cmake

package info (click to toggle)
arpon 2.0-2.1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 564 kB
  • sloc: ansic: 2,275; sh: 168; makefile: 141
file content (34 lines) | stat: -rw-r--r-- 1,419 bytes parent folder | download
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
# FindPhtread search and find the libphtread library path and header path
#
# The following variables are set:
# CMAKE_C_FLAGS - flags to add to the C compiler for build arpon
# CMAKE_INCLUDE - include path Cflag
# CMAKE_LIBS    - library path Cflag
#
# Copyright 2010 <Giuseppe Marco Randazzo> zeld@freaknet.org
#
# Redistribution AND use is allowed according to the terms of the New
# BSD license.

find_path(PTHREAD_INCLUDE_DIR ${libpthread_h} ${CMAKE_INCLUDE_PATH})

find_path(PTHREAD_LIB_DIR ${libpthread} ${CMAKE_LIBRARY_PATH})

find_library(PTHREAD_LIBRARY NAMES ${libpthread} PATH ${CMAKE_LIBRARY_PATH})

if(PTHREAD_INCLUDE_DIR AND PTHREAD_LIBRARY )
  message(STATUS "Found Libphtread.")

  if(NOT ${INCLUDE_DIR} MATCHES ${PTHREAD_INCLUDE_DIR})
    include_directories(${PTHREAD_INCLUDE_DIR})
    set(INCLUDE_DIR "${INCLUDE_DIR} ${PTHREAD_INCLUDE_DIR}")
  endif(NOT ${INCLUDE_DIR} MATCHES ${PTHREAD_INCLUDE_DIR})

  if(PTHREAD_LIB_DIR AND NOT ${LIB_DIR} MATCHES ${PTHREAD_LIB_DIR})
    link_directories(${PTHREAD_LIB_DIR})
    set(LIB_DIR "${LIB_DIR} ${PTHREAD_LIB_DIR}")
  endif(NOT ${LIB_DIR} MATCHES ${PTHREAD_LIB_DIR})

else(NOT PTHREAD_INCLUDE_DIR OR NOT PTHREAD_LIB_DIR OR NOT PTHREAD_LIBRARY)
  message(FATAL_ERROR " Libpthread not found! \n Please visit  http://www.gnu.org/software/libc/libc.html or see in the arpon 'INSTALL' file.")
endif(PTHREAD_INCLUDE_DIR AND PTHREAD_LIB_DIR AND PTHREAD_LIBRARY)