|
| 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 | +# - Find GFLAGS (gflags.h, libgflags.a, libgflags.so, and libgflags.so.0) |
| 19 | +# This module defines |
| 20 | +# GFLAGS_INCLUDE_DIR, directory containing headers |
| 21 | +# GFLAGS_SHARED_LIB, path to libgflags shared library |
| 22 | +# GFLAGS_STATIC_LIB, path to libgflags static library |
| 23 | +# GFLAGS_FOUND, whether gflags has been found |
| 24 | + |
| 25 | +if( NOT "$ENV{GFLAGS_HOME}" STREQUAL "") |
| 26 | + file( TO_CMAKE_PATH "$ENV{GFLAGS_HOME}" _native_path ) |
| 27 | + list( APPEND _gflags_roots ${_native_path} ) |
| 28 | +elseif ( GFlags_HOME ) |
| 29 | + list( APPEND _gflags_roots ${GFlags_HOME} ) |
| 30 | +endif() |
| 31 | + |
| 32 | +if ( _gflags_roots ) |
| 33 | + find_path(GFLAGS_INCLUDE_DIR NAMES gflags/gflags.h |
| 34 | + PATHS ${_gflags_roots} |
| 35 | + NO_DEFAULT_PATH |
| 36 | + PATH_SUFFIXES "include" ) |
| 37 | + find_library(GFLAGS_SHARED_LIB NAMES gflags |
| 38 | + PATHS ${_gflags_roots} |
| 39 | + NO_DEFAULT_PATH |
| 40 | + PATH_SUFFIXES "lib" ) |
| 41 | + find_library(GFLAGS_SHARED_LIB NAMES libgflags.a |
| 42 | + PATHS ${_gflags_roots} |
| 43 | + NO_DEFAULT_PATH |
| 44 | + PATH_SUFFIXES "lib" ) |
| 45 | +else() |
| 46 | + find_path(GFLAGS_INCLUDE_DIR gflags/gflags.h |
| 47 | + # make sure we don't accidentally pick up a different version |
| 48 | + NO_CMAKE_SYSTEM_PATH |
| 49 | + NO_SYSTEM_ENVIRONMENT_PATH) |
| 50 | + find_library(GFLAGS_SHARED_LIB gflags |
| 51 | + NO_CMAKE_SYSTEM_PATH |
| 52 | + NO_SYSTEM_ENVIRONMENT_PATH) |
| 53 | + find_library(GFLAGS_STATIC_LIB libgflags.a |
| 54 | + NO_CMAKE_SYSTEM_PATH |
| 55 | + NO_SYSTEM_ENVIRONMENT_PATH) |
| 56 | +endif() |
| 57 | + |
| 58 | +include(FindPackageHandleStandardArgs) |
| 59 | +find_package_handle_standard_args(GFLAGS REQUIRED_VARS |
| 60 | + GFLAGS_SHARED_LIB GFLAGS_STATIC_LIB GFLAGS_INCLUDE_DIR) |
0 commit comments