|
| 1 | +# - Try to find UUID |
| 2 | +# Once done this will define |
| 3 | +# |
| 4 | +# UUID_FOUND - system has UUID |
| 5 | +# UUID_INCLUDE_DIRS - the UUID include directory |
| 6 | +# UUID_LIBRARIES - Link these to use UUID |
| 7 | +# UUID_DEFINITIONS - Compiler switches required for using UUID |
| 8 | +# |
| 9 | +# Copyright (c) 2006 Andreas Schneider <mail@cynapses.org> |
| 10 | +# |
| 11 | +# Redistribution and use is allowed according to the terms of the New |
| 12 | +# BSD license. |
| 13 | +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. |
| 14 | +# |
| 15 | + |
| 16 | +include(CheckSymbolExists) |
| 17 | + |
| 18 | +# On mac, it can't find uuid library |
| 19 | +# So, just check for the functions with the default include |
| 20 | +CHECK_SYMBOL_EXISTS("uuid_generate" "uuid/uuid.h" UUID_SYMBOL) |
| 21 | + |
| 22 | +if (UUID_SYMBOL) |
| 23 | + set(UUID_FOUND TRUE) |
| 24 | +elseif (UUID_LIBRARIES AND UUID_INCLUDE_DIRS) |
| 25 | + # in cache already |
| 26 | + set(UUID_FOUND TRUE) |
| 27 | +else (UUID_LIBRARIES AND UUID_INCLUDE_DIRS) |
| 28 | + find_path(UUID_INCLUDE_DIR |
| 29 | + NAMES |
| 30 | + uuid/uuid.h |
| 31 | + PATHS |
| 32 | + ${UUID_DIR}/include |
| 33 | + $ENV{UUID_DIR}/include |
| 34 | + $ENV{UUID_DIR} |
| 35 | + ${DELTA3D_EXT_DIR}/inc |
| 36 | + $ENV{DELTA_ROOT}/ext/inc |
| 37 | + $ENV{DELTA_ROOT} |
| 38 | + ~/Library/Frameworks |
| 39 | + /Library/Frameworks |
| 40 | + /usr/local/include |
| 41 | + /usr/include |
| 42 | + /usr/include/gdal |
| 43 | + /sw/include # Fink |
| 44 | + /opt/local/include # DarwinPorts |
| 45 | + /opt/csw/include # Blastwave |
| 46 | + /opt/include |
| 47 | + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include |
| 48 | + /usr/freeware/include |
| 49 | + ) |
| 50 | + |
| 51 | + find_library(UUID_LIBRARY |
| 52 | + NAMES |
| 53 | + uuid |
| 54 | + PATHS |
| 55 | + ${UUID_DIR}/lib |
| 56 | + $ENV{UUID_DIR}/lib |
| 57 | + $ENV{UUID_DIR} |
| 58 | + ${DELTA3D_EXT_DIR}/lib |
| 59 | + $ENV{DELTA_ROOT}/ext/lib |
| 60 | + $ENV{DELTA_ROOT} |
| 61 | + $ENV{OSG_ROOT}/lib |
| 62 | + ~/Library/Frameworks |
| 63 | + /Library/Frameworks |
| 64 | + /usr/local/lib |
| 65 | + /usr/lib |
| 66 | + /sw/lib |
| 67 | + /opt/local/lib |
| 68 | + /opt/csw/lib |
| 69 | + /opt/lib |
| 70 | + /usr/freeware/lib64 |
| 71 | + ) |
| 72 | + |
| 73 | + find_library(UUID_LIBRARY_DEBUG |
| 74 | + NAMES |
| 75 | + uuidd |
| 76 | + PATHS |
| 77 | + ${UUID_DIR}/lib |
| 78 | + $ENV{UUID_DIR}/lib |
| 79 | + $ENV{UUID_DIR} |
| 80 | + ${DELTA3D_EXT_DIR}/lib |
| 81 | + $ENV{DELTA_ROOT}/ext/lib |
| 82 | + $ENV{DELTA_ROOT} |
| 83 | + $ENV{OSG_ROOT}/lib |
| 84 | + ~/Library/Frameworks |
| 85 | + /Library/Frameworks |
| 86 | + /usr/local/lib |
| 87 | + /usr/lib |
| 88 | + /sw/lib |
| 89 | + /opt/local/lib |
| 90 | + /opt/csw/lib |
| 91 | + /opt/lib |
| 92 | + /usr/freeware/lib64 |
| 93 | + ) |
| 94 | + |
| 95 | + set(UUID_INCLUDE_DIRS ${UUID_INCLUDE_DIR}) |
| 96 | + set(UUID_LIBRARIES ${UUID_LIBRARY}) |
| 97 | + |
| 98 | + if (UUID_INCLUDE_DIRS AND UUID_LIBRARIES) |
| 99 | + set(UUID_FOUND TRUE) |
| 100 | + endif (UUID_INCLUDE_DIRS AND UUID_LIBRARIES) |
| 101 | + |
| 102 | + if (UUID_FOUND) |
| 103 | + if (NOT UUID_FIND_QUIETLY) |
| 104 | + message(STATUS "Found UUID : ${UUID_LIBRARIES}") |
| 105 | + endif (NOT UUID_FIND_QUIETLY) |
| 106 | + else (UUID_FOUND) |
| 107 | + if (UUID_FIND_REQUIRED) |
| 108 | + message(FATAL_ERROR "Could not find UUID") |
| 109 | + endif (UUID_FIND_REQUIRED) |
| 110 | + endif (UUID_FOUND) |
| 111 | + |
| 112 | + # show the UUID_INCLUDE_DIRS and UUID_LIBRARIES variables only in the advanced view |
| 113 | + mark_as_advanced(UUID_INCLUDE_DIRS UUID_LIBRARIES) |
| 114 | + |
| 115 | +endif (UUID_SYMBOL) |
0 commit comments