File: FindUUID.cmake

package info (click to toggle)
scitokens-cpp 1.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,988 kB
  • sloc: cpp: 25,363; makefile: 14
file content (116 lines) | stat: -rw-r--r-- 2,968 bytes parent folder | download | duplicates (2)
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# - Try to find UUID
# Once done this will define
#
#  UUID_FOUND - system has UUID
#  UUID_INCLUDE_DIRS - the UUID include directory
#  UUID_LIBRARIES - Link these to use UUID
#  UUID_DEFINITIONS - Compiler switches required for using UUID
#
#  Copyright (c) 2006 Andreas Schneider <mail@cynapses.org>
#
#  Redistribution and use is allowed according to the terms of the New
#  BSD license.
#  For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#

if (APPLE)
  include(CheckSymbolExists)
  # On mac, it can't find uuid library
  # So, just check for the functions with the default include
  CHECK_SYMBOL_EXISTS("uuid_generate" "uuid/uuid.h" UUID_SYMBOL)
endif (APPLE)

if (UUID_SYMBOL)
  set(UUID_FOUND TRUE)
elseif (UUID_LIBRARIES AND UUID_INCLUDE_DIRS)
  # in cache already
  set(UUID_FOUND TRUE)
else (UUID_LIBRARIES AND UUID_INCLUDE_DIRS)
  find_path(UUID_INCLUDE_DIR
    NAMES
      uuid/uuid.h
    PATHS
      ${UUID_DIR}/include
      $ENV{UUID_DIR}/include
      $ENV{UUID_DIR}
      ${DELTA3D_EXT_DIR}/inc
      $ENV{DELTA_ROOT}/ext/inc
      $ENV{DELTA_ROOT}
      ~/Library/Frameworks
      /Library/Frameworks
      /usr/local/include
      /usr/include
      /usr/include/gdal
      /sw/include # Fink
      /opt/local/include # DarwinPorts
      /opt/csw/include # Blastwave
      /opt/include
      [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include
      /usr/freeware/include
  )

  find_library(UUID_LIBRARY
    NAMES
      uuid
    PATHS
      ${UUID_DIR}/lib
      $ENV{UUID_DIR}/lib
      $ENV{UUID_DIR}
      ${DELTA3D_EXT_DIR}/lib
      $ENV{DELTA_ROOT}/ext/lib
      $ENV{DELTA_ROOT}
      $ENV{OSG_ROOT}/lib
      ~/Library/Frameworks
      /Library/Frameworks
      /usr/local/lib
      /usr/lib
      /sw/lib
      /opt/local/lib
      /opt/csw/lib
      /opt/lib
      /usr/freeware/lib64
  )

  find_library(UUID_LIBRARY_DEBUG
    NAMES
      uuidd
    PATHS
      ${UUID_DIR}/lib
      $ENV{UUID_DIR}/lib
      $ENV{UUID_DIR}
      ${DELTA3D_EXT_DIR}/lib
      $ENV{DELTA_ROOT}/ext/lib
      $ENV{DELTA_ROOT}
      $ENV{OSG_ROOT}/lib
      ~/Library/Frameworks
      /Library/Frameworks
      /usr/local/lib
      /usr/lib
      /sw/lib
      /opt/local/lib
      /opt/csw/lib
      /opt/lib
      /usr/freeware/lib64
  )

  set(UUID_INCLUDE_DIRS ${UUID_INCLUDE_DIR})
  set(UUID_LIBRARIES ${UUID_LIBRARY})

  if (UUID_INCLUDE_DIRS AND UUID_LIBRARIES)
     set(UUID_FOUND TRUE)
  endif (UUID_INCLUDE_DIRS AND UUID_LIBRARIES)

  if (UUID_FOUND)
    if (NOT UUID_FIND_QUIETLY)
      message(STATUS "Found UUID : ${UUID_LIBRARIES}")
    endif (NOT UUID_FIND_QUIETLY)
  else (UUID_FOUND)
    if (UUID_FIND_REQUIRED)
      message(FATAL_ERROR "Could not find UUID")
    endif (UUID_FIND_REQUIRED)
  endif (UUID_FOUND)

  # show the UUID_INCLUDE_DIRS and UUID_LIBRARIES variables only in the advanced view
  mark_as_advanced(UUID_INCLUDE_DIRS UUID_LIBRARIES)

endif (UUID_SYMBOL)