File: FindDAOS.cmake

package info (click to toggle)
fdb 5.15.12-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 71,656 kB
  • sloc: cpp: 33,340; sh: 4,075; python: 166; makefile: 31; ansic: 8
file content (164 lines) | stat: -rw-r--r-- 4,769 bytes parent folder | download | duplicates (3)
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# Copyright 2022 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
#
#     http://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.

include(FindPackageHandleStandardArgs)

# daos

find_path(DAOS_INCLUDE_DIR
    NAMES daos.h
    HINTS
        ${DAOS_ROOT}
        ${DAOS_DIR}
        ${DAOS_PATH}
        ENV DAOS_ROOT
        ENV DAOS_DIR
        ENV DAOS_PATH
    PATH_SUFFIXES include
)

find_library(DAOS_LIBRARY
    NAMES daos
    HINTS
        ${DAOS_ROOT}
        ${DAOS_DIR}
        ${DAOS_PATH}
        ENV DAOS_ROOT
        ENV DAOS_DIR
        ENV DAOS_PATH
    PATH_SUFFIXES lib lib64
)

# daos_common

find_library(DAOS_COMMON_LIBRARY
    NAMES daos_common
    HINTS
        ${DAOS_ROOT}
        ${DAOS_DIR}
        ${DAOS_PATH}
        ENV DAOS_ROOT
        ENV DAOS_DIR
        ENV DAOS_PATH
    PATH_SUFFIXES lib lib64
)

# gurt

find_library(GURT_LIBRARY
    NAMES gurt
    HINTS
        ${DAOS_ROOT}
        ${DAOS_DIR}
        ${DAOS_PATH}
        ENV DAOS_ROOT
        ENV DAOS_DIR
        ENV DAOS_PATH
    PATH_SUFFIXES lib lib64
)

# daos tests

# if not using dummy DAOS, then the daos_tests lib should be installed
# from daos RPMs into the corresponding system directories. However its
# headers (daos/tests_lib.h) are not provided in any of the RPMs and 
# need to be copied from source. tests_lib.h could be copied into standard 
# system directories together with other DAOS headers, but the tests_lib.h
# file includes many other DAOS headers not provided by RPMs and other 
# external library headers, e.g. boost, and are required when compiling a 
# program which includes tests_lib.h (e.g. fdb5's DAOS backend with 
# DAOS_ADMIN enabled for unit testing). To avoid having to install all 
# these headers, tests_lib.h can be copied in a user directory and modified
# to only declare the necessary functions (pool create and destroy) and 
# remove most of the includes. All this explains why a DAOS_TESTS_INCLUDE_ROOT
# environment variable is used here to find tests_lib.h rather than DAOS_ROOT.

find_path(DAOS_TESTS_INCLUDE_DIR
    NAMES daos/tests_lib.h
    HINTS
        ${DAOS_TESTS_INCLUDE_ROOT}
        ${DAOS_TESTS_DIR}
        ${DAOS_TESTS_PATH}
        ENV DAOS_TESTS_INCLUDE_ROOT
        ENV DAOS_TESTS_DIR
        ENV DAOS_TESTS_PATH
    PATH_SUFFIXES include
)

find_library(DAOS_TESTS_LIBRARY
    NAMES daos_tests
    HINTS
        ${DAOS_ROOT}
        ${DAOS_DIR}
        ${DAOS_PATH}
        ENV DAOS_ROOT
        ENV DAOS_DIR
        ENV DAOS_PATH
    PATH_SUFFIXES lib lib64
)

find_package_handle_standard_args(
    DAOS
    DEFAULT_MSG
    DAOS_LIBRARY
    DAOS_INCLUDE_DIR
    DAOS_COMMON_LIBRARY
    GURT_LIBRARY )

mark_as_advanced(DAOS_INCLUDE_DIR DAOS_LIBRARY DAOS_COMMON_LIBRARY GURT_LIBRARY)

if(DAOS_FOUND)
    add_library(daos UNKNOWN IMPORTED GLOBAL)
    set_target_properties(daos PROPERTIES
        IMPORTED_LOCATION ${DAOS_LIBRARY}
        INTERFACE_INCLUDE_DIRECTORIES ${DAOS_INCLUDE_DIR}
    )
    add_library(daos_common UNKNOWN IMPORTED GLOBAL)
    set_target_properties(daos_common PROPERTIES
        IMPORTED_LOCATION ${DAOS_COMMON_LIBRARY}
        INTERFACE_INCLUDE_DIRECTORIES ${DAOS_INCLUDE_DIR}
    )
    add_library(gurt UNKNOWN IMPORTED GLOBAL)
    set_target_properties(gurt PROPERTIES
        IMPORTED_LOCATION ${GURT_LIBRARY}
        INTERFACE_INCLUDE_DIRECTORIES ${DAOS_INCLUDE_DIR}
    )
    set(DAOS_INCLUDE_DIRS ${DAOS_INCLUDE_DIR})
    list(APPEND DAOS_LIBRARIES daos daos_common gurt)
endif()

find_package_handle_standard_args(
    DAOS_TESTS
    DEFAULT_MSG
    DAOS_TESTS_LIBRARY
    DAOS_TESTS_INCLUDE_DIR )

mark_as_advanced(DAOS_TESTS_INCLUDE_DIR DAOS_TESTS_LIBRARY)

if(DAOS_TESTS_FOUND)
    add_library(daos_tests UNKNOWN IMPORTED GLOBAL)
    set_target_properties(daos_tests PROPERTIES
        IMPORTED_LOCATION ${DAOS_TESTS_LIBRARY}
        INTERFACE_INCLUDE_DIRECTORIES "${DAOS_TESTS_INCLUDE_DIR};${DAOS_INCLUDE_DIR}"
    )
    list(APPEND DAOS_TESTS_INCLUDE_DIRS 
        ${DAOS_TESTS_INCLUDE_DIR}
        ${DAOS_INCLUDE_DIR}
    )
    set(DAOS_TESTS_LIBRARIES daos_tests)
endif()