]> git.proxmox.com Git - ceph.git/blame - ceph/src/arrow/cpp/cmake_modules/FindgflagsAlt.cmake
import quincy 17.2.0
[ceph.git] / ceph / src / arrow / cpp / cmake_modules / FindgflagsAlt.cmake
CommitLineData
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
18set(find_package_args)
19if(gflagsAlt_FIND_VERSION)
20 list(APPEND find_package_args ${gflagsAlt_FIND_VERSION})
21endif()
22if(gflagsAlt_FIND_QUIETLY)
23 list(APPEND find_package_args QUIET)
24endif()
25find_package(gflags ${find_package_args})
26if(gflags_FOUND)
27 set(gflagsAlt_FOUND TRUE)
28 return()
29endif()
30
31# TODO: Support version detection.
32
33if(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})
44else()
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})
49endif()
50
51find_package_handle_standard_args(gflagsAlt REQUIRED_VARS gflags_LIB GFLAGS_INCLUDE_DIR)
52
53if(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)
59endif()