# - Find LOG4CPLUSclient
# Find the native LOG4CPLUS includes and library
#
#  LOG4CPLUS_INCLUDE_DIR - where to find LOG4CPLUS.h, etc.
#  LOG4CPLUS_LIBRARIES   - List of libraries when using LOG4CPLUS.
#  LOG4CPLUS_FOUND       - True if LOG4CPLUS found.

IF (LOG4CPLUS_INCLUDE_DIR)
  # Already in cache, be silent
  SET(LOG4CPLUS_FIND_QUIETLY TRUE)
ENDIF (LOG4CPLUS_INCLUDE_DIR)

FIND_PATH(LOG4CPLUS_INCLUDE_DIR log4cplus.h
  /usr/local/include/log4cplus
  /usr/include/log4cplus
)

SET(LOG4CPLUS_NAME log4cplus)
FIND_LIBRARY(LOG4CPLUS_LIBRARY
  NAMES ${LOG4CPLUS_NAME}
  PATHS /usr/lib /usr/local/lib
  PATH_SUFFIXES log4cplus
)

IF (LOG4CPLUS_INCLUDE_DIR AND LOG4CPLUS_LIBRARY)
  SET(LOG4CPLUS_FOUND TRUE)
  SET( LOG4CPLUS_LIBRARIES ${LOG4CPLUS_LIBRARY} )
ELSE (LOG4CPLUS_INCLUDE_DIR AND LOG4CPLUS_LIBRARY)
  SET(LOG4CPLUS_FOUND FALSE)
  SET( LOG4CPLUS_LIBRARIES )
ENDIF (LOG4CPLUS_INCLUDE_DIR AND LOG4CPLUS_LIBRARY)

if(LOG4CPLUS_LIBRARIES)
  get_filename_component(LOG4CPLUS_LIB_DIR ${LOG4CPLUS_LIBRARIES} PATH)
endif(LOG4CPLUS_LIBRARIES)

IF (LOG4CPLUS_FOUND)
  IF (NOT LOG4CPLUS_FIND_QUIETLY)
    MESSAGE(STATUS "Found LOG4CPLUS: ${LOG4CPLUS_LIBRARY}")
  ENDIF (NOT LOG4CPLUS_FIND_QUIETLY)
ELSE (LOG4CPLUS_FOUND)
  IF (LOG4CPLUS_FIND_REQUIRED)
    MESSAGE(STATUS "Looked for LOG4CPLUS libraries named ${LOG4CPLUS_NAME}.")
    MESSAGE(FATAL_ERROR "Could NOT find LOG4CPLUS library")
  ENDIF (LOG4CPLUS_FIND_REQUIRED)
ENDIF (LOG4CPLUS_FOUND)

MARK_AS_ADVANCED(
  LOG4CPLUS_LIBRARY
  LOG4CPLUS_LIB_DIR
  LOG4CPLUS_INCLUDE_DIR
  LOG4CPLUS_NAME
  )
