]>
Commit | Line | Data |
---|---|---|
1d09f67e TL |
1 | # Licensed to the Apache Software Foundation (ASF) under one |
2 | # or more contributor license agreements. See the NOTICE file | |
3 | # distributed with this work for additional information | |
4 | # regarding copyright ownership. The ASF licenses this file | |
5 | # to you under the Apache License, Version 2.0 (the | |
6 | # "License"); you may not use this file except in compliance | |
7 | # with the License. You may obtain a copy of the License at | |
8 | # | |
9 | # http://www.apache.org/licenses/LICENSE-2.0 | |
10 | # | |
11 | # Unless required by applicable law or agreed to in writing, | |
12 | # software distributed under the License is distributed on an | |
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
14 | # KIND, either express or implied. See the License for the | |
15 | # specific language governing permissions and limitations | |
16 | # under the License. | |
17 | ||
18 | set(find_package_args) | |
19 | if(gflagsAlt_FIND_VERSION) | |
20 | list(APPEND find_package_args ${gflagsAlt_FIND_VERSION}) | |
21 | endif() | |
22 | if(gflagsAlt_FIND_QUIETLY) | |
23 | list(APPEND find_package_args QUIET) | |
24 | endif() | |
25 | find_package(gflags ${find_package_args}) | |
26 | if(gflags_FOUND) | |
27 | set(gflagsAlt_FOUND TRUE) | |
28 | return() | |
29 | endif() | |
30 | ||
31 | # TODO: Support version detection. | |
32 | ||
33 | if(gflags_ROOT) | |
34 | find_library(gflags_LIB | |
35 | NAMES gflags | |
36 | PATHS ${gflags_ROOT} | |
37 | PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} | |
38 | NO_DEFAULT_PATH) | |
39 | find_path(GFLAGS_INCLUDE_DIR | |
40 | NAMES gflags/gflags.h | |
41 | PATHS ${gflags_ROOT} | |
42 | NO_DEFAULT_PATH | |
43 | PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES}) | |
44 | else() | |
45 | find_library(gflags_LIB NAMES gflags) | |
46 | find_path(GFLAGS_INCLUDE_DIR | |
47 | NAMES gflags/gflags.h | |
48 | PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES}) | |
49 | endif() | |
50 | ||
51 | find_package_handle_standard_args(gflagsAlt REQUIRED_VARS gflags_LIB GFLAGS_INCLUDE_DIR) | |
52 | ||
53 | if(gflagsAlt_FOUND) | |
54 | add_library(gflags::gflags UNKNOWN IMPORTED) | |
55 | set_target_properties(gflags::gflags | |
56 | PROPERTIES IMPORTED_LOCATION "${gflags_LIB}" | |
57 | INTERFACE_INCLUDE_DIRECTORIES "${GFLAGS_INCLUDE_DIR}") | |
58 | set(GFLAGS_LIBRARIES gflags::gflags) | |
59 | endif() |