1# - Find gflags library
2# Find the gflags includes and library
3#
4# gflags_INCLUDE_DIR - where to find gflags.h.
5# gflags_LIBRARIES - List of libraries when using gflags.
6# gflags_FOUND - True if gflags found.
7
8find_path(GFLAGS_INCLUDE_DIR
9  NAMES gflags/gflags.h)
10
11find_library(GFLAGS_LIBRARIES
12  NAMES gflags)
13
14include(FindPackageHandleStandardArgs)
15find_package_handle_standard_args(gflags
16  DEFAULT_MSG GFLAGS_LIBRARIES GFLAGS_INCLUDE_DIR)
17
18mark_as_advanced(
19  GFLAGS_LIBRARIES
20  GFLAGS_INCLUDE_DIR)
21
22if(gflags_FOUND AND NOT (TARGET gflags::gflags))
23  add_library(gflags::gflags UNKNOWN IMPORTED)
24  set_target_properties(gflags::gflags
25    PROPERTIES
26      IMPORTED_LOCATION ${GFLAGS_LIBRARIES}
27      INTERFACE_INCLUDE_DIRECTORIES ${GFLAGS_INCLUDE_DIR}
28      IMPORTED_LINK_INTERFACE_LANGUAGES "CXX")
29endif()
30