FIND_PATH(GFLAGS_INCLUDE_DIR gflags/gflags.h
  /usr/local/include
  /usr/include
  /opt/local/include
)

FIND_LIBRARY(GFLAGS_LIBRARY NAMES gflags)

INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GFLAGS DEFAULT_MESSAGE GFLAGS_INCLUDE_DIR)

IF(GFLAGS_FOUND)
  SET( GFLAGS_LIBRARIES ${GFLAGS_LIBRARY} )
  IF(NOT GFLAGS_FIND_QUIETLY)
    MESSAGE(STATUS "Found GFLAGS (GFLAGS_LIBRARIES = ${GFLAGS_LIBRARIES})")
    MESSAGE(STATUS "Found GFLAGS (GFLAGS_INCLUDE_DIR = ${GFLAGS_INCLUDE_DIR})")
  ENDIF(NOT GFLAGS_FIND_QUIETLY)
ELSE(GFLAGS_FOUND)
  IF(GFLAGS_FIND_REQUIRED)
    MESSAGE(FATAL_ERROR "Could not find GFLAGS")
  ENDIF(GFLAGS_FIND_REQUIRED)
ENDIF(GFLAGS_FOUND)

MARK_AS_ADVANCED(GFLAGS_INCLUDE_DIR GFLAGS_LIBRARY)

