File: FindLibUUID.cmake

package info (click to toggle)
fdb 5.18.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 75,160 kB
  • sloc: cpp: 34,924; sh: 4,315; python: 187; makefile: 32; ansic: 8
file content (108 lines) | stat: -rw-r--r-- 3,106 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
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
# Copyright 2024- European Centre for Medium-Range Weather Forecasts (ECMWF)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovernmental organisation nor
# does it submit to any jurisdiction.
#
# Requires:
#  FindPackageHandleStandardArgs (CMake standard module)
#

#[=======================================================================[.rst:
FindLibUUID
--------

This module finds the libuuid (from util-linux) library.

Imported Targets
^^^^^^^^^^^^^^^^

This module provides the following imported targets, if found:

``LibUUID``
  The libuuid library

Result variables
^^^^^^^^^^^^^^^^

This module will set the following variables in your project:

``LIB_UUID_FOUND``
  True if the libuuid library is found.
``LIB_UUID_INCLUDE_DIRS``
  Include directories needed to use libuuid.
``LIB_UUID_LIBRARIES``
  Libraries needed to link to libuuid.

Cache variables
^^^^^^^^^^^^^^^

The following cache variables may also be set to help find libuuid library:

``LIB_UUID_INCLUDE_DIR``
  where to find the libuuid headers.
``LIB_UUID_LIBRARY``
  where to find the libuuid library.

Hints
^^^^^

The environment variables ``LIB_UUID_ROOT``, ``LIB_UUID_DIR``, and ``LIB_UUID_PATH``
may also be set to help find libuuid library.

#]=======================================================================]

find_path(LIB_UUID_INCLUDE_DIR uuid.h
    HINTS
        ${LIB_UUID_ROOT}
        ${LIB_UUID_DIR}
        ${LIB_UUID_PATH}
        ENV LIB_UUID_ROOT
        ENV LIB_UUID_DIR
        ENV LIB_UUID_PATH
    PATH_SUFFIXES uuid
)

find_library(LIB_UUID_LIBRARY
    NAMES uuid
    HINTS
        ${LIB_UUID_ROOT}
        ${LIB_UUID_DIR}
        ${LIB_UUID_PATH}
        ENV LIB_UUID_ROOT
        ENV LIB_UUID_DIR
        ENV LIB_UUID_PATH
    PATH_SUFFIXES lib lib64
)

include(FindPackageHandleStandardArgs)

find_package_handle_standard_args(LibUUID REQUIRED_VARS
                                    LIB_UUID_LIBRARY
                                    LIB_UUID_INCLUDE_DIR)

if (LibUUID_FOUND)
    set(LIB_UUID_LIBRARIES ${LIB_UUID_LIBRARY})
    set(LIB_UUID_INCLUDE_DIRS ${LIB_UUID_INCLUDE_DIR})
    if(NOT TARGET LibUUID)
        add_library(LibUUID UNKNOWN IMPORTED)
        set_target_properties(LibUUID PROPERTIES
            IMPORTED_LOCATION "${LIB_UUID_LIBRARY}"
            INTERFACE_INCLUDE_DIRECTORIES "${LIB_UUID_INCLUDE_DIR}"
            INTERFACE_LINK_LIBRARIES "${LIB_UUID_LIBRARY}")
    endif()
endif()

mark_as_advanced(LIB_UUID_INCLUDE_DIR LIB_UUID_LIBRARY)